By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,694 Members | 1,294 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,694 IT Pros & Developers. It's quick & easy.

Problems referencing frame containing external page

P: n/a

Hi frame experts c",) Hope you can help me out on this one

I've got a frameset (index.html) on my server (server A) defining two
frames. Left frame is named "menu" and contains a page (menu.html) which is
located on the same server while right frame is named "main" and contains a
page (main.html) which is located on another server (server B). This page
has a form named "f" with an element named "id". I want to access/read the
value of this element from the left frame, but I get an access denied error.
Can anybody please help me!

Just to test, I've put an exact copy of the page on server B, onto server A,
and then I have no problems accessing the value. I use the following code:

window.parent.main.f.id.value

I've also tested the frame structure (see the code below the line). When the
page in the right frame is located on server B, it seems like the whole
reference to the right frame is lost.

I also get the same results if I put all three documents on my computer and
fire up the site with http://localhost/index.html and set the right frame
source to http://127.0.0.1/main.html

I use IE

Any help is appreciated c",) Thanks!

Best regards Morten.

----------------------------------------------------------------------------
--------------

Show Frame Structure

1. Visit any web site with frames
2. Paste the following into the browser addressbar (remove any line breaks)
3. Watch a window popup which shows the frame heirarchy of the page being
visited

javascript:function
dt0(W,N,fo,i){fo=eval(N);W.document.write('<li>'+f o.name+'['+fo.document.tit
le+'-'+fo.document.location.pathname+']');if(fo.length>0){W.document.write('
<ul>');for(i=0;i<fo.length;i++){dt0(W,N+'.frames['+i+']',undefined,0);}W.doc
ument.write('</ul>');}};function
dt(W,N){W.document.clear();W.document.write('<ul>' );dt0(W,N,undefined,0);W.d
ocument.write('</ul>');W.focus();};function
s(){window.open('','W').close();W=window.open('',' W','height=500,width=500,r
esizable');dt(W,'top');};s()

----------------------------------------------------------------------------
--------------
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a


Morten Thorsen wrote:

I've got a frameset (index.html) on my server (server A) defining two
frames. Left frame is named "menu" and contains a page (menu.html) which is
located on the same server while right frame is named "main" and contains a
page (main.html) which is located on another server (server B). This page
has a form named "f" with an element named "id". I want to access/read the
value of this element from the left frame, but I get an access denied error.


Yes, browsers implement the same origin policy for scripts to prevent
you from loading a bank login site for instance and then sniff login
data. Unless you have host1.domain.tld and host2.domain.tld where you
can then set
document.domain = 'domain.tld'
in script to allow the access there is nothing you can do besides using
a HTML application (.hta file) for instance on Windows

http://msdn.microsoft.com/library/de...node_entry.asp
or using local pages with Mozilla and then let your script request the
privilege to access the other page.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #2

P: n/a
Ok. Thanks for your quick and educational answer. I now understand that it's
probably for the best that we're unable to do such references. In this
particular case, I'd sure liked to be able to do it though c",) I don't know
much about the other two solutions of yours, but I guess the result would be
a private, local service and not a public web service. Right?

Morten.

"Martin Honnen" <ma*******@yahoo.de> skrev i melding
news:40******@olaf.komtel.net...


Morten Thorsen wrote:

I've got a frameset (index.html) on my server (server A) defining two
frames. Left frame is named "menu" and contains a page (menu.html) which is located on the same server while right frame is named "main" and contains a page (main.html) which is located on another server (server B). This page has a form named "f" with an element named "id". I want to access/read the value of this element from the left frame, but I get an access denied
error.
Yes, browsers implement the same origin policy for scripts to prevent
you from loading a bank login site for instance and then sniff login
data. Unless you have host1.domain.tld and host2.domain.tld where you
can then set
document.domain = 'domain.tld'
in script to allow the access there is nothing you can do besides using
a HTML application (.hta file) for instance on Windows

http://msdn.microsoft.com/library/de...node_entry.asp or using local pages with Mozilla and then let your script request the
privilege to access the other page.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #3

P: n/a


Morten Thorsen wrote:

I don't know
much about the other two solutions of yours, but I guess the result would be
a private, local service and not a public web service.


You can offer an HTA (HTML application) on a public web server but the
user then has to download it like a normal application to run it.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.