Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Oct 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    loading pages when user exits

    Is there a javascript code for loading php pages when the user exits the forum?

    For example I am writing a webpage where I would like it to run the logout script when the user exits the forum, if they have not already logged out. Is this possible to do with JavaScript? (using sessions in forum not cookies).

  • #2
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Simply put, all logins should be done using a server-side language. If the user closes the browser, the session is lost and therefore "logged out". Blend your website login and forum login scripts together and include them on all pages in your website. JavaScript is not a secure language and should never be used for security.

    Hope this helps

    m_n
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper

  • #3
    New Coder
    Join Date
    Oct 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    oh sorry probably did word the question right i didn't mean that the forum was attached to a website, its just so that when the user exits the forum or browser, i wanted it to run a certain page and I thought maybe you could use JavaScript but I maybe mistaken. Should php be used instead?

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,609
    Thanks
    0
    Thanked 645 Times in 635 Posts
    When a person closes their browser there is nothing running to process any further code at all.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •