HighDots Forums  

Testing framesets and opening top page accordingly with JavaScript

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss Testing framesets and opening top page accordingly with JavaScript in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jon
 
Posts: n/a

Default Testing framesets and opening top page accordingly with JavaScript - 04-19-2006 , 10:40 AM






Hi there,

I'm having a bit of difficulty with a function that will open a link
depending on the calling frameset.
The function (promoLink()) is located in a frame
(trinity.getminted.com) and depending on the frameset
(www.instanwinmirror.com or www.sundaymailinstantwin.com) I wish to
open the link www.instantwincasino.com and www.sundaymailcasino.com
respectively.

I am having trouble testing the properties of the frameset, I have
tried the following and javaScript does not seem to recognise them as a
string.

function promoLink()
{

if (parent.topFrame.location.href = ...
if (top.location.href=..
if (window.top.document.location.href=..

}

I'd appreciate any pointers! Thanks in advance for looking.
Jon


Reply With Quote
  #2  
Old   
Randy Webb
 
Posts: n/a

Default Re: Testing framesets and opening top page accordingly with JavaScript - 04-19-2006 , 11:49 PM






Jon said the following on 4/19/2006 10:40 AM:
Quote:
Hi there,

I'm having a bit of difficulty with a function that will open a link
depending on the calling frameset.
The function (promoLink()) is located in a frame
(trinity.getminted.com) and depending on the frameset
(www.instanwinmirror.com or www.sundaymailinstantwin.com) I wish to
open the link www.instantwincasino.com and www.sundaymailcasino.com
respectively.
You can't. The reason you can't is that you can't read the location
property of the parent frameset due to cross domain security restrictions.

Quote:
I am having trouble testing the properties of the frameset, I have
tried the following and javaScript does not seem to recognise them as a
string.
It should give you a Security Warning or something to that effect if the
page that promoLink is in is from a different domain than the frameset.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Reply With Quote
  #3  
Old   
Jon
 
Posts: n/a

Default Re: Testing framesets and opening top page accordingly with JavaScript - 04-20-2006 , 04:25 AM



Oh thanks Randy..
Is there no way of getting around it then? No way of getting
top.location.href or something?

I would have thought this problem would be quite common, particularly
with white label sites that wish to link to different URLs depending on
the domain

thanks for your help

Jon


Reply With Quote
  #4  
Old   
Randy Webb
 
Posts: n/a

Default Re: Testing framesets and opening top page accordingly with JavaScript - 04-20-2006 , 07:17 PM



Jon said the following on 4/20/2006 4:25 AM:
Quote:
Oh thanks Randy..
Is there no way of getting around it then? No way of getting
top.location.href or something?
No, it is a security issue. Look at the flip side. Would you want me to
be able to put your bank's website in a 100% wide/high IFrame and read
data from it?

Quote:
I would have thought this problem would be quite common, particularly
with white label sites that wish to link to different URLs depending on
the domain
It is very common and the solution is the same - you can't from the client.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Reply With Quote
Reply




Thread Tools
Display Modes

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

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.