Where did you install Firefox from? Help Mozilla uncover 3rd party websites that offer problematic Firefox installation by taking part in our campaign. There will be swag, and you'll be featured in our blog if you manage to report at least 10 valid reports!

Iskanje po podpori

Izogibajte se prevarantski tehnični podpori. Nikoli vam ne bomo naročili, da pokličete telefonsko številko ali nam pošljete osebne podatke. Sumljivo dejavnost prijavite z gumbom »Prijavi zlorabo«.

Learn More

How to detect back browser event in javascript?

  • 2 odgovora
  • 23 ima to težavo
  • 17 ogledov
  • Zadnji odgovor od guigs

more options

How to detect browser event in javascript? Not working for me. Since i love mozilla to use. Working in IE.

function HandleBackFunctionality(event) {


  if(window.event)
  {
       alert("Browser1");
       if(window.event.clientX < 40 && window.event.clientY < 0)
       {
           alert("Browser back button is clicked...");
       }
       else
       {
           alert("Browser refresh button is clicked...");
       }
   }
   else
   {
        alert("Browser2");
       if(event.currentTarget.performance.navigation.type == 1)
       {
            alert("Browser refresh button is clicked...");
       }
       if(event.currentTarget.performance.navigation.type == 2)
       {
            alert("Browser back button is clicked...");
       }
   }

}

How to detect browser event in javascript? Not working for me. Since i love mozilla to use. Working in IE. function HandleBackFunctionality(event) { if(window.event) { alert("Browser1"); if(window.event.clientX < 40 && window.event.clientY < 0) { alert("Browser back button is clicked..."); } else { alert("Browser refresh button is clicked..."); } } else { alert("Browser2"); if(event.currentTarget.performance.navigation.type == 1) { alert("Browser refresh button is clicked..."); } if(event.currentTarget.performance.navigation.type == 2) { alert("Browser back button is clicked..."); } } }

Vsi odgovori (2)

more options

Firefox doesn't have a catch-all event object (window.event), but you can create event listeners for the objects of interest. I don't know whether the toolbar is one of those; probably not, since why should web pages be able to see what you are doing on the toolbar??

If we discard the idea of looking for events outside of the page and focus on what is happening inside the page, have you looked at this:

https://developer.mozilla.org/en-US/docs/Web/API/Window.onbeforeunload

more options

Please also try the new version of Firefox. Update Firefox to the latest release