I have a grid with a couple of columns specified as link Excell types
sField + “^javascript:OpenWindow(” + sField + “);^_self”;
The call itself works fine, however I keep getting
a pop-up window asking
Are you sure you want to leave this page?
I am not really leaving the website, since I am calling a javascript within the same page, that reference into the object holding the grid in which the link is embedded.
function OpenWindow(sID) {
goMain.myGrid().OpenWindow(sID);
}
How do I specify in the link that, so I can stop getting that message every time I click a link?
I don’t want to disable detection whether or not I am leaving the page all together, just indicate this is a local call.
For anybody with the same problem, here is my solution:
in the onbeforeunload event handler I check if the BASE_URL match my virtual dir, if it does, I return without a string, indicating No pop-up box, otherwise I give the lecture:
window.onbeforeunload = function (e) {
if (e.target.BASE_URL == "/myArea/")
return ;
return "Warning: Leaving this page may result in loss of current state.";
};
May be more elegant solutions out there though, that I would be happy to learn if you have one, since this still require the code to know the name of the virtual dir.
For anybody with the same problem, here is my solution:
in the onbeforeunload event handler I check if the BASE_URL match my virtual dir, if it does, I return without a string, indicating No pop-up box, otherwise I give the lecture:
window.onbeforeunload = function (e) {
if (e.target.BASE_URL == "/myArea/")
return ;
return "Warning: Leaving this page may result in loss of current state.";
};
May be more elegant solutions out there though, that I would be happy to learn if you have one, since this still require the code to know the name of the virtual dir.