Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to neutralize a top.location.replace ? 1

Status
Not open for further replies.

Newcomsas

Programmer
Mar 26, 2008
3
0
0
IT
Hello,

I have got a rather nasty problem with framesets and JS.
I am trying to include into a frame of an HTML page the content of an external site (let's say:
The pages of the external site contain anyway a JS code that automatically put their content in the top position; the code looks like this:

<script type="text/javascript" charset="utf-8">
if (top != self) { top.location.replace(' }
</script>

Is it possible, in your opinion, to 'neutralize' this behaviour, placing a suitable code on my HTML (frameset) page ?
I thank you in advance for any help.

Newcomsas
 
Is it possible, in your opinion, to 'neutralize' this behaviour

Stop using frames, maybe?


To answer your intended question - no.

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson

[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
 
You could try putting this code in your very top level page:

Code:
top.location.replace = function() { return false; };

Not sure if it'll work or not, but give it a whirl anyway.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Or, using server-side scripting, you could scrape the other page, remove that code, and rewrite it on your page. You run the risk of copyright infringement doing that kind of thing, though.

Lee
 
BillyRayPreachersSon, I thank you, the code you posted actually works fine on IE; unfortunely it seems to be ignored by Firefox.
Is there in your knowledge a way to fix this problem ? Thanks.

Newcomsas
 
It's probably the case then that Firefox has some security in place to stop you from overriding this method.

Perhaps some sort of signed script might work? I'd search around on Google (or ask on here) for how to get elevated script rights in Fx... it's not something I've any experience with, though.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top