开发者

How to make javascript link target to my iframe?

开发者 https://www.devze.com 2023-02-01 06:13 出处:网络
I have a iframe and there is a javascript function in it. Basically开发者_如何学Go, I want to create an anchor tag to call the function and activate it in my iframe. Do you have any idea?

I have a iframe and there is a javascript function in it. Basically开发者_如何学Go, I want to create an anchor tag to call the function and activate it in my iframe. Do you have any idea?

<p><a href="javascript:document.body.contentEditable='true'; document.designMode='on'; void 0" target="test">Edit Google</a></p>

<iframe name="test" src="http://www.google.com"></iframe>

It is not working. Any idea?


I was searching around trying to find an answer, but I think it's easier if I just give you a link to this site that I found: http://www.dyn-web.com/tutorials/iframes/refs.php


You can't do that for obvious security reasons: one website can't and should never be able to control anything in other website.

If both pages are in the same domain there is a way, but different domains? Nope.

Instead of showing iframe you can try loading the external site with AJAX, parse the result and show your own form.

0

精彩评论

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