Get IFRAME url

N

nicknack

Hi.

I have a strange problem wuth IFRAME.

I have page aaa.aspx with an IFRAME that contain page bbb.aspx.

page bbb.aspx sometimes redirect him self to page ccc.aspx.

The problem is that after I loaded the aaa.aspx page I want to know
what page do I see in the IFRAME. (aaa or bbb).

What I've tried to do is to run a JS in the onLoad of aaa.aspx that
after 5 seconds get the "src" property of the IFRAME but I saw that
even if bbb.aspx redirect to ccc.aspx the source is still bbb.aspx.

I know it complex but I really hope you can help me.

Thanks.
 
P

Patrice

So using redirect could well perhaps change the document location but leave
src unchanged (after all you didn't tell the parent frame the location
should be changed).

So something that could work would be to get the document.location for this
document rather than using the src attribute of its parent frame.
 
N

nicknack

Hi Patrice,

Thanks for the reply.
The question is how can I get the location of the page inside the
IFRAME?

I didn't saw any way to get the location of the real document inside
the IFRAME?

Thanks.


Patrice כתב:
 
P

Patrice

Try ifrm.document.location.href, ifrm being the ID of your IFRAME tag...

--
Patrice

"nicknack" <[email protected]> a écrit dans le message de
(e-mail address removed)...
Hi Patrice,

Thanks for the reply.
The question is how can I get the location of the page inside the
IFRAME?

I didn't saw any way to get the location of the real document inside
the IFRAME?

Thanks.


Patrice ???:
 
N

nicknack

Damn, It look good for a moment :(

I tried it but in internet explorer it return me the url of the parent
page (aaa.aspx) and not bbb or ccc.

In fire fox nothing happen :(

any more ideas?

Thanks.
 
P

Patrice

Tried it on IE6/FF2 and works here.

There is two problem :
1) - for cross browser code use window.frames[0].location

2) I'm not sure why you don't have the correct result in IE. I tried :
- a first page "a.asp" that includes a "b.asp" page using an iframe
- the "b" page redirects to the "c" page

I addeed a button on the "a" page to display the info once the page is
loaded.

In both browser I see that the src attribute still point to the "b" page
while window.frames[0].location gives the "c" page location...

Good luck.


"nicknack" <[email protected]> a écrit dans le message de
(e-mail address removed)...
Damn, It look good for a moment :(

I tried it but in internet explorer it return me the url of the parent
page (aaa.aspx) and not bbb or ccc.

In fire fox nothing happen :(

any more ideas?

Thanks.
 
N

nicknack

Hi Patrice,

I don't understand how you made it work.
I tried to use window.frams[0].location but I got "access denied"
error.
I think I read some where that there is some sort of security
protection on iframe :(

I really don't understand this.
may be it because you used asp while I use aspx?

Any way, I tried every solution I can think of and I tried to check
every properties for the "window" properties and its just didn't work.

very strange if you say that it worked fine for you.

I'll try to investigate it some more.

Any way, I really appreciate your help!
It helped me alot.

Roy.

Patrice כתב:
Tried it on IE6/FF2 and works here.

There is two problem :
1) - for cross browser code use window.frames[0].location

2) I'm not sure why you don't have the correct result in IE. I tried :
- a first page "a.asp" that includes a "b.asp" page using an iframe
- the "b" page redirects to the "c" page

I addeed a button on the "a" page to display the info once the page is
loaded.

In both browser I see that the src attribute still point to the "b" page
while window.frames[0].location gives the "c" page location...

Good luck.


"nicknack" <[email protected]> a écrit dans le message de (e-mail address removed)...
Damn, It look good for a moment :(

I tried it but in internet explorer it return me the url of the parent
page (aaa.aspx) and not bbb or ccc.

In fire fox nothing happen :(

any more ideas?

Thanks.
Try ifrm.document.location.href, ifrm being the ID of your IFRAME tag...

--
Patrice

"nicknack" <[email protected]> a écrit dans le message de (e-mail address removed)...
Hi Patrice,

Thanks for the reply.
The question is how can I get the location of the page inside the
IFRAME?

I didn't saw any way to get the location of the real document inside
the IFRAME?

Thanks.


Patrice ???:
 
P

Patrice

This is client side so using ASP or ASPX doesn't make a difference.

Does your iframe goes on the same domain. I used a path such "/b.asp"...


Patrice

"nicknack" <[email protected]> a écrit dans le message de
(e-mail address removed)...
Hi Patrice,

I don't understand how you made it work.
I tried to use window.frams[0].location but I got "access denied"
error.
I think I read some where that there is some sort of security
protection on iframe :(

I really don't understand this.
may be it because you used asp while I use aspx?

Any way, I tried every solution I can think of and I tried to check
every properties for the "window" properties and its just didn't work.

very strange if you say that it worked fine for you.

I'll try to investigate it some more.

Any way, I really appreciate your help!
It helped me alot.

Roy.

Patrice ???:
Tried it on IE6/FF2 and works here.

There is two problem :
1) - for cross browser code use window.frames[0].location

2) I'm not sure why you don't have the correct result in IE. I tried :
- a first page "a.asp" that includes a "b.asp" page using an iframe
- the "b" page redirects to the "c" page

I addeed a button on the "a" page to display the info once the page is
loaded.

In both browser I see that the src attribute still point to the "b" page
while window.frames[0].location gives the "c" page location...

Good luck.


"nicknack" <[email protected]> a écrit dans le message de (e-mail address removed)...
Damn, It look good for a moment :(

I tried it but in internet explorer it return me the url of the parent
page (aaa.aspx) and not bbb or ccc.

In fire fox nothing happen :(

any more ideas?

Thanks.
Try ifrm.document.location.href, ifrm being the ID of your IFRAME tag...

--
Patrice

"nicknack" <[email protected]> a écrit dans le message de (e-mail address removed)...
Hi Patrice,

Thanks for the reply.
The question is how can I get the location of the page inside the
IFRAME?

I didn't saw any way to get the location of the real document inside
the IFRAME?

Thanks.


Patrice ???:
 

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,786
Messages
2,569,626
Members
45,328
Latest member
66Teonna9

Latest Threads

Top