Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Track Internet Explorer close forcibly by user

Track Internet Explorer close forcibly by user

Scheduled Pinned Locked Moved ASP.NET
javascriptsysadmin
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Amit Agarrwal
    wrote on last edited by
    #1

    hello, I want to track / or want to excecute some function (javascript/server side) when any user try to close the Internet Explorer window forcibly. i tried so many googling..... but didn't get any desire result..

    Amit Agarwal

    A 1 Reply Last reply
    0
    • A Amit Agarrwal

      hello, I want to track / or want to excecute some function (javascript/server side) when any user try to close the Internet Explorer window forcibly. i tried so many googling..... but didn't get any desire result..

      Amit Agarwal

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      It is really not good to track the browser close event. You can do that using :

      if(window.event.clientX < 0 && window.event.clientY <0)
      {
      // your code
      }

      Call this Method From Body Unload. But it wont do when user forcibly close the browser. If the user normally close using

      , Alt+F4 , File -> Close
      it will run your code. But if the user ends the process from TaskManager... So I strongly suggest you not to track browser close. Rather track Session Timeout in the server.. If not your requirement really needed this.:cool:

      Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


      My Latest Articles-->** Simplify Code Using NDepend
      Basics of Bing Search API using .NET
      Microsoft Bing MAP using Javascript

      A 1 Reply Last reply
      0
      • A Abhishek Sur

        It is really not good to track the browser close event. You can do that using :

        if(window.event.clientX < 0 && window.event.clientY <0)
        {
        // your code
        }

        Call this Method From Body Unload. But it wont do when user forcibly close the browser. If the user normally close using

        , Alt+F4 , File -> Close
        it will run your code. But if the user ends the process from TaskManager... So I strongly suggest you not to track browser close. Rather track Session Timeout in the server.. If not your requirement really needed this.:cool:

        Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


        My Latest Articles-->** Simplify Code Using NDepend
        Basics of Bing Search API using .NET
        Microsoft Bing MAP using Javascript

        A Offline
        A Offline
        Amit Agarrwal
        wrote on last edited by
        #3

        Thanks for your valuable suggestion, code and time. actually my requirement is to create a Audit trail for User Login and Logout. if user login to the system, then i make a entry into the Database. if user successfully Logout to the system then i make the logout entry in the database. but what will happen if user close the IE directly with logout to the system or Alt + f4 or close IE by right click or any thing else. that is my actual requirement..

        Amit Agarwal

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups