开发者

Make iframe editable in jsfiddle

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜