check the content of another frame or iFrame function is tripping browser security

C

Ciaran

Hi I'm trying to write a function that checks the url or title of a page in
an iframe nested in the same page. I can do it if all pages are local but I
need the iFrame to load a webpage which seems to be tripping the security
feature. Is there any way around this or is there some other way I can get
an update on what's going on in the iFrame?


Here's the code in my local file:
javascript:
function checkpage(){
alert(hid.document.URL);
}

html:
<iframe name="hid" id="hid" onload="checkpage()"
src='http://www.google.com'></iframe>


Thanks,
Ciarán
 
A

ASM

En réponse à Ciaran qui nous a susurré, en date du : 24/07/07 21:42, le
message sibyllin suivant :
Hi I'm trying to write a function that checks the url or title of a page in
an iframe nested in the same page. I can do it if all pages are local but I
need the iFrame to load a webpage which seems to be tripping the security
feature. Is there any way around this or is there some other way I can get
an update on what's going on in the iFrame?

you can't manipulate a foreign page

cross-domain is formaly forbiden
<iframe name="hid" id="hid" onload="checkpage()"
src='http://www.google.com'></iframe>

Is your site on Google ?
No ?
so you cant' touch its pages (via JS)
 
C

Ciaran

Is your site on Google ?
No ?
so you cant' touch its pages (via JS)

No, It's a local html page, running from my desktop. I dont want to 'touch'
the google page, I just want to check the url of the page that's being
displayed in the iframe. Come on! surely there's someone out there who can
figure out a way to do it??!
 
A

ASM

En réponse à Ciaran qui nous a susurré, en date du : 24/07/07 22:13, le
message sibyllin suivant :
No, It's a local html page, running from my desktop.

And then ?
Do you think your browser is stupid and doesn't know what is JavaScript ?
I dont want to 'touch'

play, make, interfer ...
the google page, I just want to check the url of the page that's being
displayed in the iframe. Come on! surely there's someone out there who can
figure out a way to do it??!

Don't you launch it there ?
You forgot it?

It's url belongs to it, no?



The correct javascript could be:
function checkpage(){
alert(parent.hid.location);
}

But that can't work, even in local mode, if the file loaded in the
iframe comes from another domain.
(Firefox the last on Mac 10.4)
 
S

scripts.contact

It's a local html page, running from my desktop. I dont want to 'touch'
the google page, I just want to check the url of the page that's being
displayed in the iframe.

Use HTA. You can then do anything with the page.. >-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top