IndianaGuy Posted December 22, 2016 Share Posted December 22, 2016 There is a tone of articles about this online but most are from 2012 and older. I can't seem to find fresh information. Does anyone know if and how to make the onbeforeunload Event work on mobile devices? Thank you Link to comment Share on other sites More sharing options...
thescientist Posted December 22, 2016 Share Posted December 22, 2016 can you provide an example? is it not firing at all? what devices? all of them? Link to comment Share on other sites More sharing options...
IndianaGuy Posted December 23, 2016 Author Share Posted December 23, 2016 (edited) Here it is. It did not work on Safari or Chrome (iPhone). RecordAction() was tested with other events and it works. window.onbeforeunload = function() { var Expo = document.getElementById("exposure"); var ct = ConvertTime(Expo.currentTime); var Action = " ClOSED the BROWSER WINDOW ON"; RecordAction(Member,Prospect,FileName,Action,ct); }; Edited December 23, 2016 by IndianaGuy Link to comment Share on other sites More sharing options...
Ingolme Posted December 23, 2016 Share Posted December 23, 2016 I would start by testing with an alert() statement. If your RecordAction() method is making an AJAX request which is asynchronous, then the browser may choose the leave the page before the request has been completed. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now