ZeroClipboard/zlip导致iframe中出现不安全的Javascript警告
我正在使用zClip:(并且尝试了ZeroClipboard,也得到了相同的结果) 当我在iframe中使用它时,我得到以下javascript错误/警告:ZeroClipboard/zlip导致iframe中出现不安全的Javascript警告,javascript,cross-domain,zeroclipboard,Javascript,Cross Domain,Zeroclipboard,我正在使用zClip:(并且尝试了ZeroClipboard,也得到了相同的结果) 当我在iframe中使用它时,我得到以下javascript错误/警告: Unsafe JavaScript attempt to access frame with URL file://localhost/Users/me/Desktop/test.html from frame with URL http://localhost:3000/a. The frame requesting access has
Unsafe JavaScript attempt to access frame with URL file://localhost/Users/me/Desktop/test.html from frame with URL http://localhost:3000/a. The frame requesting access has a protocol of 'http', the frame being accessed has a protocol of 'file'. Protocols must match.
file://localhost/Users/me/Desktop/test.html 是一个本地文件,我在其中设置了一个iframe,用于加载我的小部件。复制按钮位于小部件中
尽管有错误,复制功能似乎工作得很好,所以我不确定它为什么会出现,我想清理一下
这是小部件中的我的咖啡/javascript:
btn = $('#'+id)
btn.zclip
path: '/flash/ZeroClipboard.swf',
copy: btn.data('copy')
这只是标准的东西。当我对btn.zlip
块进行注释时,错误消失了,因此它似乎就是那一行
我假设zeroclip javascript中有一些东西在iframe之外冒泡到父级,但我无法立即找到任何东西。我想知道是否还有其他人解决了这个问题。谢谢 每当flash对象嵌入到跨域iframe中时,它都会引发跨域异常 例如,检查这个嵌入了iFrame的JSFIDLE:
请参见相关内容:
<object width="420" height="315"><param name="movie" value="http://www.youtube.com/v/6V_DsL1x1uY?version=3&hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/6V_DsL1x1uY?version=3&hl=en_US" type="application/x-shockwave-flash" width="420" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>