賈維斯的智慧工坊

  • Home
  • About
  • Note
  • Project
  • Experience
  • Service
  • Sitemap


MY | NOTES

  1. 首頁
  2. >
  3. 筆記
  4. >
  5. 網頁設計

Google AdSense Uncaught Error

Aug, 2017
解決Google廣告在網站無法正常運作

Problem

Using Google AdSense

Error

Got an uncaught message in the console panel
( Press Ctrl+Shift+J (Windows / Linux) or Cmd+Opt+J (Mac). )

adsbygoogle.push() error: All ins elements in the DOM with class=adsbygoogle already have ads in them.

Solution

If you didn't use repeated class name, it still show this message...
Because your website page is too long, it didn't finish loading.
Google AdSense script couldn't successfully start the advisement.
Jusu using a timer to execute the script later.

setTimeout(function(){ (adsbygoogle = window.adsbygoogle || []).push({}); }, 2000);


← Back to note