编程语言/sketch:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
Kangkk​(留言 | 贡献)
第96行: 第96行:
</syntaxhighlight>
</syntaxhighlight>
|}
|}
=== html ===
==== iframe ====
在 sketch 的 iframe 中,由于使用 iframe 并不能获取其 contentWindow,这与 photoshop 有着极大的区别。
{{leftrightflex|<syntaxhighlight lang="javascript">
console.log(iframe.contentDocument)
console.log(iframe.contentWindow.document)
</syntaxhighlight>|{{consoleout|<pre>Blocked a frame with origin "null" from accessing a frame with origin "https://login.ops.qihoo.net:4430".  The frame requesting access has a protocol of "file", the frame being accessed has a protocol of "https". Protocols must match.
null
SecurityError: Blocked a frame with origin "null" from accessing a cross-origin frame. Protocols, domains, and ports must match.
Error: A cross-origin error was thrown. React doesn't have access to the actual error object in development. See https://fb.me/react-crossorigin-error for more information.
</pre>}}}}
所以需要调整策略,改用 postmessage。


== 调试 ==
== 调试 ==