Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-12-2011, 11:50 AM   PM User | #1
ei42
New to the CF scene

 
Join Date: Feb 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
ei42 is an unknown quantity at this point
Is there a way to overide this javascript externally?

Hi

I'm a complete numpty when it comes to javascript so please excuse my ignorance.

I have a link to a site that I usually open in an iframe, the source of that site now contains this code...

<script type="text/javascript">if(top.location.href!=self.location.href)top.location.href=self.location.href;</script>

Which unless I am mistaken means "Get the hell out of any frames"

Is there anything that I can do in my iframe code to overide that and force the site into my iframe or will javascript always win this battle?

Thanks in advance

Steve
ei42 is offline   Reply With Quote
Old 02-12-2011, 12:21 PM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,033
Thanks: 197
Thanked 2,410 Times in 2,388 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Fortunately, Javascript will always win the battle.

The site you refer to does not wish you to load it into your iframe. Period.

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
Philip M is offline   Reply With Quote
Old 02-12-2011, 12:24 PM   PM User | #3
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,587
Thanks: 5
Thanked 864 Times in 841 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
Well, the only way to win a battle over JavaScript is to disable it.
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 02-12-2011, 07:29 PM   PM User | #4
oesxyl
Master Coder


 
Join Date: Dec 2007
Posts: 6,682
Thanks: 436
Thanked 890 Times in 879 Posts
oesxyl is a jewel in the roughoesxyl is a jewel in the roughoesxyl is a jewel in the rough
Quote:
Originally Posted by VIPStephan View Post
Well, the only way to win a battle over JavaScript is to disable it.
on the server side?

best regards
oesxyl is offline   Reply With Quote
Old 02-13-2011, 05:13 AM   PM User | #5
venegal
Gütkodierer


 
Join Date: Apr 2009
Posts: 2,127
Thanks: 1
Thanked 426 Times in 424 Posts
venegal has a spectacular aura aboutvenegal has a spectacular aura about
You can use the onbeforeunload event to at least give the user a chance to cancel the redirection. But probably you just shouldn't embed the site in yours, since their owner obviously doesn't want you to.
venegal is offline   Reply With Quote
Old 02-13-2011, 11:21 PM   PM User | #6
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,452
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
once upon a time you could use <object> instead of <iframe>, but i don't know if that trick still works...
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.8% IE9:11.4% IE10:6.5%
rnd me is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:52 AM.


Advertisement
Log in to turn off these ads.