/    Sign up×
Community /Pin to ProfileBookmark

Unexpected Problem

I’m developing a large externally loaded javascript which has brought an unexpected problem to light.

The entire script appears to work fine, so long as it’s loaded on my site’s server.

It doesn’t, however, work if one of my pages is loaded into a frame from another server.

Why isn’t my script working on servers other than my own?

if (window.opera) top.location.replace (‘http://www.robindean.com/content.php?display=browser‘);
else if (top.location.href != “http://www.robindean.com/content.php” && window.name != ‘webcast’ && window.name != ‘webcast_code’ && window.name != ‘help’ && window.name != ‘gallery’) top.location.replace (‘http://www.robindean.com/content.php‘);

function SetMediaCookie(value)
{
exp = new Date();
exp.setTime(exp.getTime() + 86400000);
document.cookie = “RobinDeanMedia=” + escape(value) + “; expires=” + exp.toGMTString();
}

if (window.location.href == “http://www.robindean.com/content.php?display=navigation“) SetMediaCookie(“0”);

if (window.location.pathname == “/audio.php” && !top.upper.document.navigation.TCallFrame) top.location.replace (‘content.php?display=browser’);

var selection = null;

function GetPage(content,frameset)
{
if (frameset == “hidden”) selection = top.hidden.location.replace(content);
else if (frameset == “lower”) selection = top.lower.location.replace(content);
else if (frameset == “new”) selection = window.open(content);
else return false;
return true;
}

document.oncontextmenu = new Function(“return false;”)

if (window.name != ‘upper’)
{
document.onselectstart = new Function (“return false;”)
document.onmousedown = new Function (“return false;”)
document.onclick = new Function (“return true;”)
}

function buy(sel)
{
var item = sel[sel.selectedIndex].value;
if (item != ”) w_buy = window.open (item);
}

function reSet(target, frameNumber)
{
top.upper.document.navigation.TCallFrame(target, frameNumber);
}

var webcast = null;
var help = null;
var sonic = null;
var gallery = null;

function PopUp(url, name, width, height)
{
var attrs = ‘width=’ + width + ‘, height=’ + height + ‘, innerWidth=’ + width + ‘, innerHeight=’ + height + ‘, outerWidth=’ + width + ‘, outerHeight=’ + height + ‘, screenX=0, left=0, screenY=0, top=0, channelmode=0, dependent=0, directories=0, fullscreen=0, location=0, menubar=0, resizable=0, scrollbars=0, status=0, toolbar=0’;
if (name == “webcast”) webcast = window.open(url, name, attrs);
else if (name == “help”) help = window.open(url, name, attrs);
else if (name == “sonic”) sonic = window.open(url, name, attrs);
else if (name == “gallery”) gallery = window.open(url, name, attrs);
else return false;
return true;
}

function ShowDates()
{
opener.document.navigation.TCallFrame(‘/’, 45);
}

function view(sel)
{
var page = sel[sel.selectedIndex].value;
if (page != ”) window.location.replace (page);
}

function play(sel)
{
var media = sel[sel.selectedIndex].value;
if (media != ”) top.upper.document.navigation.SetVariable(‘/:bootleg’, media);
reSet(‘/’, 44);
}

function Configure()
{
var excludedomain = [“www.robindean.com”];
rexcludedomain = new RegExp(excludedomain, “i”);
for (i = 0; i <= (document.links.length-1); i++)
{
if (document.links[i].hostname.search(rexcludedomain) == -1 && document.links[i].href.indexOf(“http:”) != -1) document.links[i].target = “new”
}
if (window.name == ‘webcast_code’) window.scroll(6, 39);
if (window.name == ‘webcast’ || window.name == ‘help’ || window.name == ‘gallery’) window.focus();
}

window.onload = Configure;

function CleanUp()
{
if (window.name == ‘lower’)
{
reSet(‘/’, 46);
if (!gallery.closed && gallery.location) gallery.close();
}
}

window.onunload = CleanUp;

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@FangMar 07.2007 — Security, you are not allowed to reference objects in a document on a different server.
Copy linkTweet thisAlerts:
@robindeanauthorMar 08.2007 — but you can do so via php, right?
×

Success!

Help @robindean spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...