获取到 Google 代码:
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js">
</script>
<!-- Google 内容广告 -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="xxxxx"
data-ad-slot="xxxxxx"
data-ad-format="auto">
</ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
加入到网页 div 中。会操错如下:
Uncaught SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "http://www.jeffjade.com" from accessing a frame with origin "http://googleads.g.doubleclick.net". Protocols, domains, and ports must match.
目测看着像是跨域了,搜索网上方法,采用
<script>document.domian='jeffjade.com'</script>
等等一系列尝试,还是会有各种问题,比如
Uncaught SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "http://www.jeffjade.com" from accessing a frame with origin "https://googleads.g.doubleclick.net". The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "https". Protocols must match.
网上对这个资料目测不多;所以在这里请教下,这问题该如何解决呢?感谢。
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.