Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
Posts: 43
Registered: ‎02-05-2010
My Device: 8900
My Carrier: don't know

iframe actual url

Hello everyone,

 

my question is, how can I get the url of a site which is open in the iframe? So with "location.href" I only get the iframe location but not the url of the opened site. Do you know how I can solve it?

 

thanx

newone

Developer
Posts: 43
Registered: ‎02-05-2010
My Device: 8900
My Carrier: don't know

Re: iframe actual url

Hello,

 

is there no idea or no way?

 

Need it.

 

thanx

newone

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: iframe actual url

The only way to get the url location is if the origin of the content that is in the iframe is the same origin as the page that contains the iframe.

 

This is a security feature that is blocked in browsers.

 

If they are all in the same domain/origin you should be able to get it from the iframe's contentWindow object.

 

I "think" it looks something like.

 

document.getElementById("myIFrame").contentWindow.location.href

 

 

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 17
Registered: ‎04-19-2012
My Device: Torch
My Carrier: Telenor Denmark

Re: iframe actual url

Does the same apply for apps? I mean, can I get the URL of the page loaded in the iframe if I open the frame in my application? Case: I open a frame for OAuth authentication.  Thanks