control what page is loaded no matter what link was clicked, possible?

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;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top