![]() | 1 sneezry 2014-02-26 20:53:57 +08:00 ![]() window.top.document.referrer |
![]() | 2 s200612321 OP @sneezry 还是会出问题 Uncaught SecurityError: Blocked a frame with origin "chrome-extension://ipafkdgpadpmhlokecilnbjfnflcojpp" from accessing a frame with origin "http://xxx.com". The frame requesting access has a protocol of "chrome-extension", the frame being accessed has a protocol of "http". Protocols must match. 我在 iframe 加载完后绑定一个事件 $(document).ready(function() { console.log(window.top.document.referrer); } 还有其他的方法传递消息吗? |
![]() | 3 wong2 2014-02-26 21:25:29 +08:00 |
![]() | 4 sneezry 2014-02-26 21:37:38 +08:00 哦,那就只能用message了 |
![]() | 5 sneezry 2014-02-26 21:38:34 +08:00 content script创建iframe的时候把url作为hash或者search写到src里也可以 |
![]() | 7 s200612321 OP @sneezry 不太懂,如何在 content script 创建iframe的时候把url作为hash或者search写到src里 |
![]() | 8 s200612321 OP @sneezry 好像明白了点 在 content script 创建iframe的时候,在 url 中传递hash 参数, 比如 <iframe src="http://www.v2ex.com/content/index.html?url='xxx/xxx/xxx'"></iframe> 然后在 iframe 里面就可以获取到 url='xxx/xxx/xxx' 这样应该可以吧,还没有调试 |