Currently
window.onbeforeunload = function() {
fires every time i exit the page, is it possible to get the requested window.location
from a link and if the URL is not the value of a variable run the window.onbeforeunload = function()
.
Currently
window.onbeforeunload = function() {
fires every time i exit the page, is it possible to get the requested window.location
from a link and if the URL is not the value of a variable run the window.onbeforeunload = function()
.
You can attach the onbeforeunload
if the loaded url is not equal to variable. But you cant oprevent the attached function's execution
<script type="text/javascript">
if(window.location.href!=myvar)
{
window.onbeforeunload=function(){};
}
</script>
ahren is right here
function experiment() {
experimentEnviroment();
$('a').click(function(){
var regestedPage = $(this).attr("href");
var myvar = "bsc.html"
if( regestedPage != myvar ) {
$(this).bind('ready',windowUnload());
}
});
}