Currently trying to run a function through the window.addListener('unload') event. This is the code I am trying to run:
window.addEventListener('unload', this.returnToDashboard)
returnToDashboard():
location.href = './'
The event gets triggered on Firefox but does not work on Chrome. My Chrome Version is: Version 104.0.5112.79 (Official Build) (x86_64)
Not sure why it is not working on Chrome. Any insight would be appreciated on alternatives. Thank you.
Update:
According to the MDN docs I am supposed to be using pagehide event but that does not trigger for Chrome either.
Related
I need to prevent the scroll caused by focus().
For this purpose, I found that if I use element.focus({preventScroll : true}) instead of element.focus(), it works fine, based on the documentation from mozilla.
However, this only works perfectly on Chrome but not in Firefox.
I'm wondering how could it be not supported by FireFox, when the documentation has been done by Mozilla.
Am I missing something here?
Focus method documentation by Mozilla
I have the following clock code of JS-Clock:
$(document).ready(function(){
$(".clock").jsclock('{{date('H:i:s')}}');
});
It works fine, but on Google Chrome 63.0.3239.108 (Official Build) (64-bit) on Ubuntu 16.04, when jump to another tab or open another application window i.e blur, the clock seems to be paused.
I tested it with Opera 49.0.2725.64 and it works fine without pause. What's the root cause of this issue and how could I solve it with Chrome, if possible?
I'm trying to detect hashchanged which works fine in every browser except chrome. For example, with this code:
if ("onhashchange" in window) {
alert("The browser supports the hashchange event!");
}
The statement is never executed in Chrome but works in Firefox. I've seen a jQuery hashchange plugin on GitHub but didn't have any luck with that either.
Any ideas?
In Firefox I see this (good):
And I perfectly see attached event for this node.
But in Chrome for the same node I see (bad):
In Firefox I see that click will be handled by filterpro.min.js, but in Chrome I see links to jQuery and include.postload.js. Firefox wins?
Of course for Chrome I can use bookmarklet Visual Event:
...but this is strange - in Chrome I really can't find attached listeners for this node?
The code i used in the javascript to close the window is as follows
window.open('','_self','');
window.close();
in jsp
Close
it's not working in chrome version 36.0.1985.143, it worked in previous chrome version, IE and in FF also. How can i fix it.
Please help me.
Thanks in advance.
The chrome latest release has changed that functionlity as there has been several security issues because of that. You need to try like this:
chrome.windows.remove(integer windowId, function callback)
You can check here