This article is a mirror article of machine translation, please click here to jump to the original article.

View: 9780|Reply: 1

Fix an issue where the website added Google AdSense ads page loaded slowly

[Copy link]
Posted on 2/23/2019 10:38:16 PM | | | |
After adding Google AdSense ads to the website, every time you open the post page, the browser will sometimes spin in circles, although it is loaded asynchronously, but it looks very uncomfortable, how to solve it?

The ad code is served as follows:

I believe that friends who are starting to Google AdSense have the same feeling, that is, do you have multiple ads on one page, and each ad should refer to a "adsbygoogle.js" file?

The answer is no, you only need to introduce the "adsbygoogle.js" file once.



Google AdSense workaround preventing pages from loading

The website has jQuery

A jQuery ready event was used.


Bad results? You can even wrap it up with setTimeout and delay it for a few seconds before loading. Optimal delay of 3 seconds.


Pure JS implementation

Since my site doesn't introduce jQuery, everything can only be implemented with acoustic js, the code is as follows:

The renderings are as follows:



Google ads will be displayed on the entire website page.

(End)




Previous:MagicEXIF Editor Ultimate Cracked Version
Next:Alita: Battle Angel Original Manga - "Gun Dream"
Posted on 6/14/2019 9:18:07 AM |
You only need to introduce the "adsbygoogle.js" file once

js-window.onload can only be called once!
https://www.itsvse.com/thread-7092-1-1.html
(Source: Architect_Programmer)
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com