如何让 Google Adsense 在页面其余部分之后最后加载
我有一个包含 Google Adsense 广告的页面。 内容在左侧,广告在右侧。 下载页面时,它首先检索内容,然后从 Google Adsense 广告开始。 在此期间,直到整个广告完全下载后,才会获取页面的其余部分(页脚图像)。
如何使我的所有页面(内容、图像)首先加载,最后加载广告?
I have a page with Google Adsense ads. Content is to the left and ads are to the right.
When the page is downloading it retrieves the content first and then start with the Google Adsense ads. During that time the rest of the page (footer images) is not fetched until the whole ad is completely downloaded.
How can I make all of my page (content, images) load first and the ad load last?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
是的,这就是要走的路。 我在这里通过示例更详细地讨论了它:
http://semplicewebsites.com/google-ads
Yep, this is the way to go. I've discussed it in more detail here, with examples:
http://semplicewebsites.com/google-ads
另一个答案中的lnk:
http://semplicewebsites.com/google-ads
...绝对是要走的路。 我在使用 jQuery 时遇到了一些问题,但这就是我使用的。 经过一些 CSS 调整后,我基本上只是移动 iframe。
假设您将广告加载到页面底部名为 ads_footer 的(隐藏)div 中,并且希望它们进入名为 ads_inline 的 div 中(如链接中的示例所示< /em>)。 你可以这样做:
除了删除绝对定位之外,不需要任何浮动或花哨的 CSS。
The lnk in the other answer:
http://semplicewebsites.com/google-ads
...is definitely the way to go. I had a few issues to do it with jQuery, but this is what I used. I bascially just move the iframe, after a bit of CSS tweaking.
Assume you load the ads at the bottom of the page in a (hidden) div called ads_footer, and you want them to go in a div called ads_inline (as in the example in the link). You can do this:
No need for any floats or fancy CSS, apart from removing the absolute positioning.
您必须将广告代码放在 html(php、asp 等)页面的底部,以便浏览器最后请求该数据。 浏览器从文档顶部读取到文档末尾并一路发出请求。 我认为没有任何办法可以解决这个问题。
您仍然可以使用 CSS 将广告放置在页面顶部附近。 绝对位置,或者一些疯狂的浮动也许可以做到。
You'll have to put the ad code at the bottom of your html (php, asp, whatever) page so that the browser requests that data last. Browsers read from the top of the document to the end of the document and request along the way. I don't think there's any way around that.
You can still place the ad near the top of the page using css. An absolute position, or some crazy floats might be able to do it.
现在没有必要这样做。 AdSense 宣布广告请求将不再阻止页面内容:
http://adsense.blogspot.com /2011/03/making-web-faster-for-all-adsense-for.html
There is no need to do this now. AdSense announced that ad requests will not be blocking page content anymore:
http://adsense.blogspot.com/2011/03/making-web-faster-for-all-adsense-for.html
我认为最简单的方法是使用 body onload 启动一个 JavaScript 计时器,5 秒后将填充 div 占位符的 html。
如果您想等待所有内容加载,您将需要跟踪数组中的每个图像等。
I think the simplest way would be to use body onload to start a javascript timer which after say 5 seconds will then populate the html of a div placeholder.
If you want to wait for everything to load you will need to keep track of every image, etc in an array.