M
Mike Scirocco
I want to control what page is loaded no matter what link a user clicks
on in a page, here's what I have so far, neither exitcheck function
worked. If the user clicks OK on the alert I want to load a url I pick,
if the user clicks CANCEL on the alert I want the browser to just
display the currently loaded page and do nothing.
TIA,
Mike
function exitcheck(){
if (quit()) {
//load exit url
document.location='http://www.black.com';
}else{
//keep current page loaded in browser
}
}
function exitcheck2(){
if (quit()) {
//load exit url in browser
window.onunload=loadexiturl;
}else{
//keep current page loaded in browser
window.onunload=donothing;
}
}
function donothing(){
//do nothing
}
function loadexiturl(){
window.location='http://www.black.com';
document.location='http://www.black.com';
document.location.href='http://www.black.com';
parent.window.location.href='http://www.black.com';
}
function quit() {
if (confirm('Do you want to leave this page?')){
return true;
}else{
return false;
}
}
window.onbeforeunload = exitcheck;
//window.onbeforeunload = exitcheck2;
on in a page, here's what I have so far, neither exitcheck function
worked. If the user clicks OK on the alert I want to load a url I pick,
if the user clicks CANCEL on the alert I want the browser to just
display the currently loaded page and do nothing.
TIA,
Mike
function exitcheck(){
if (quit()) {
//load exit url
document.location='http://www.black.com';
}else{
//keep current page loaded in browser
}
}
function exitcheck2(){
if (quit()) {
//load exit url in browser
window.onunload=loadexiturl;
}else{
//keep current page loaded in browser
window.onunload=donothing;
}
}
function donothing(){
//do nothing
}
function loadexiturl(){
window.location='http://www.black.com';
document.location='http://www.black.com';
document.location.href='http://www.black.com';
parent.window.location.href='http://www.black.com';
}
function quit() {
if (confirm('Do you want to leave this page?')){
return true;
}else{
return false;
}
}
window.onbeforeunload = exitcheck;
//window.onbeforeunload = exitcheck2;