开发者

How do I get the current iframe location from within the iframe?

开发者 https://www.devze.com 2023-01-14 08:43 出处:网络
I\'ve seen solutions like top.document.getElementById(\'iframe_a\').src But the problem is, that I don\'t know the Iframes ID. My Applica开发者_开发问答tion is running as a Gmail-Gadget and therefo

I've seen solutions like

top.document.getElementById('iframe_a').src

But the problem is, that I don't know the Iframes ID. My Applica开发者_开发问答tion is running as a Gmail-Gadget and therefore I don't know which ID Google will generate.

So how can I get the URL of my gadget?

Using JQuery will also be fine.


If your script is executed within an iframe, location.href should do it. You might want to access the location object in more detail tho.

0

精彩评论

暂无评论...
验证码 换一张
取 消