开发者

Make iframe editable in jsfiddle

开发者 https://www.devze.com 2023-02-13 07:32 出处:网络
I have another questi开发者_如何学Pythonon, which i\'ll be asking shortly, but to ask this question i first need to get an iframe editable in jsfiddle. It works fine on my loacal machine, but not on j

I have another questi开发者_如何学Pythonon, which i'll be asking shortly, but to ask this question i first need to get an iframe editable in jsfiddle. It works fine on my loacal machine, but not on jsfiddle. Im assuming this is because it uses frames?

Locally I use:

setTimeout('document.getElementById("kupuText").contentWindow. document.designMode="on"',10);

But this has no effect on jsfiddle, check it out here - http://jsfiddle.net/V7b9J/

Thanks in advance, Al


You're coming up against the same-origin policy. Javascript cannot work cross-domain. This means that it can't affect the content of an iframe if the content of that iframe is served from a different domain.

Another couple of bits of advice:

  • Don't use strings for setTimeout. Use an anonymous function instead.
  • contentWindow is not cross-browser.
0

精彩评论

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

关注公众号