bleep
07-23-2003, 07:47 AM
I found the below script at javascriptsource. It's intended to keep a frame/file within several possible framesets and also to provide a path to those framesets. However, it's designed to work in conjuction with a so called "dynamic frames" script, e.g. it wont work on it's own. And the latter is what I want.
Has anyone got a solution? The script looks like this:
<SCRIPT LANGUAGE="JavaScript"><!--
ok_urls = new Array();
ok_urls[1] = "http://your-web-site-address-here.com/frameset.html";
ok_urls[2] = "http://www.your-web-site-address-here.com/frameset.html";
// Enter all the possible web addresses that your site's frameset
// page can be accessed online, such as with and without the 'www'
function reportError(msg, url, line) {
if (url == window.location.href) {
msg = "\nBandwidth Theft Alert!\n\n" +
"This site is illegally stealing bandwidth\n" +
"from our site, WWW.OUR-SITE.COM.\n\n" +
"We will now load the content page\n" +
"from our server so you may view it.\n\n" +
"Thanks for your patience!";
alert(msg);
top.location.href = ok_urls[1] + "?" + window.location.href;
return true;
}
}
window.onerror = reportError;
url_found = 0;
for (var i = 1; i <= ok_urls.length && !url_found; i++) {
url_found = (parent.location.href.indexOf(ok_urls[i]) == -1);
}
if (!url_found || (window == top))
top.location.href = ok_urls[1] + "?" + window.location.href;
// --></script>
I've tried to solve the problem with a joint version of the script with both of the following scripts but I can't get it to work anyway:
<script type="text/javascript" language="JavaScript"><!--
if ((parent.location.href == self.location.href) || (!parent.correct_frame))
window.location.href = 'test.htm';
//--></script>
OR
<script type="text/javascript" language="JavaScript"><!--
var correct_frame = 0 + (parent.nav ? 1 : 0);
if (parent.location.href == self.location.href || !correct_frame)
window.location.href = 'test.htm?dummy';
//--></script>
("dummy" is the frame name)
Anyone? (While at it, exclude the ridiculus alert thing too... Thanx!)
Has anyone got a solution? The script looks like this:
<SCRIPT LANGUAGE="JavaScript"><!--
ok_urls = new Array();
ok_urls[1] = "http://your-web-site-address-here.com/frameset.html";
ok_urls[2] = "http://www.your-web-site-address-here.com/frameset.html";
// Enter all the possible web addresses that your site's frameset
// page can be accessed online, such as with and without the 'www'
function reportError(msg, url, line) {
if (url == window.location.href) {
msg = "\nBandwidth Theft Alert!\n\n" +
"This site is illegally stealing bandwidth\n" +
"from our site, WWW.OUR-SITE.COM.\n\n" +
"We will now load the content page\n" +
"from our server so you may view it.\n\n" +
"Thanks for your patience!";
alert(msg);
top.location.href = ok_urls[1] + "?" + window.location.href;
return true;
}
}
window.onerror = reportError;
url_found = 0;
for (var i = 1; i <= ok_urls.length && !url_found; i++) {
url_found = (parent.location.href.indexOf(ok_urls[i]) == -1);
}
if (!url_found || (window == top))
top.location.href = ok_urls[1] + "?" + window.location.href;
// --></script>
I've tried to solve the problem with a joint version of the script with both of the following scripts but I can't get it to work anyway:
<script type="text/javascript" language="JavaScript"><!--
if ((parent.location.href == self.location.href) || (!parent.correct_frame))
window.location.href = 'test.htm';
//--></script>
OR
<script type="text/javascript" language="JavaScript"><!--
var correct_frame = 0 + (parent.nav ? 1 : 0);
if (parent.location.href == self.location.href || !correct_frame)
window.location.href = 'test.htm?dummy';
//--></script>
("dummy" is the frame name)
Anyone? (While at it, exclude the ridiculus alert thing too... Thanx!)