Hi All
I am writing a Chrome Extension which needs to detect the user is leaving current page either by closing Chrome, closing the tab or navigating to other page. I have tried to bind “unload” and “onbeforunload” in my content script. But it seems none of them works. Can anyone give me a hint?
Thanks
My manifest.js is listed as following
{
"name": "My First Extension",
"version": "1.0",
"manifest_version": 2,
"description": "The first extension",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"permissions": [
],
"content_scripts":[
{
"matches": ["http://www.yahoo.com/*"],
"js": ["jquery-1.7.2.min.js", "myscript.js"],
"run_at": "document_end"
}
]
}
Myscript.js is listed as following
alert("hello from myscript.js");
$(window).beforeunload(function(){
alert("In the beforeunload");
});
$(window).unload(function(){
alert("In the unload");
});
--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msg/chromium-extensions/-/lznqc_c5pcEJ.
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.