|
Q1233 How do I stop an advertisers popup window from opening, but still open my own?
irt.org | Knowledge Base | JavaScript | Window | Q1233 [ previous next ]
Q1233 How do I stop an advertisers popup window from opening, but still open my own?
If you define your own open() function:
<script language="JavaScript"><!--
function open() { }
//--></script>
|
After you've stopped the popup window you'll not be able to open
your own so try the following code which works in Netscape Navigator 3+ and Internet Explorer 4+:
<html>
<head>
<script language="JavaScript"><!--
var saveOpen = window.open;
window.open = myOpen;
if (window.focus) window.focus();
function myOpen() {
alert('No way');
return null;
}
function restoreOpen() {
window.open = saveOpen;
}
//--></script>
<head>
<body onLoad="window.open('redefine.htm','newwin')">
<a href="javascript:;" onClick="restoreOpen(); return false">restore</a>
<br>
<a href="javascript:;" onClick="window.open('redefine.htm','newwin'); return false">open</a>
</body>
</html>
|
Using this code on GeoCitites, XOOM or any other similar site might
get you thrown out.
|
|
Copyright © 1996-2008 irt.org, All Rights Reserved.