我正在为家庭外卖网站构建一个项目,我已经设法让核心设计符合我的要求。我现在在我的网站中显示 adsense 时遇到问题。
我在控制台收到一条消息
Uncaught Error: adsbygoogle.push(): All ins elements in the DOM with class=adsbygoogle already have ads in them.
请看官网http://tastygrillbristol.uk
</style>
<core-drawer-panel transition id="core_drawer_panel" touch-action>
<section id="section" drawer>
<core-header-panel mode="standard" id="core_header_panel">
<core-toolbar id="core_toolbar">
<div id="div">Menu</div>
</core-toolbar>
<section id="section2">
<core-menu selected="0" id="core_menu">
<core-item id="core_item7" icon="home" label="Home" horizontal center layout><a href="../index.html"></a></core-item>
<core-submenu id="core_submenu" icon="list" label="Online Menu">
<core-item id="core_item" label="Special Offers" horizontal center layout><a href="../menu.html"></a></core-item>
<core-item id="core_item" label="Everything" horizontal center layout><a href="../menu.html"></a></core-item>
<core-item id="core_item" label="Burgers" horizontal center layout><a href="../menuburgers.html"></a></core-item>
<core-item id="core_item1" label="Kebabs" horizontal center layout><a href="../menu.html"></a></core-item>
<core-item id="core_item2" label="Doners" horizontal center layout><a href="../menu.html"></a></core-item>
<core-item id="core_item3" label="Pizzas" horizontal center layout><a href="../menu.html"></a></core-item>
</core-submenu>
<core-item id="core_item4" icon="shopping-cart" label="Deliver to you" horizontal center layout><a href="../delivery.html"></a></core-item>
<core-item id="core_item5" icon="perm-phone-msg" label="Call us" horizontal center layout><a href="../callus.html"></a></core-item>
<core-item id="core_item6" icon="file-map" label="Find us" horizontal center layout><a href="../findus.html"></a></core-item>
<core-item id="core_item6" icon="favorite" label="Follow us" horizontal center layout ><a href="../followus.html"></a></core-item>
</core-menu>
</section>
</core-header-panel>
</section>
<section id="section1" main>
<core-scroll-header-panel condenses id="core_scroll_header_panel" headerHeight="256" condensedHeaderHeight="64">
<core-toolbar class="tall" id="core_toolbar1">
<paper-icon-button core-drawer-toggle id="navicon" icon="menu"></paper-icon-button>
<div flex></div>
<div horizontal center-justified layout class="bottom indent title" > <p><b><font color=#FF1744>Tasty Grill</font></b></p> </div>
</core-toolbar>
<div class="content" horizontal layout center>
<post-card1>
<div align="center"><h2 align="center">WELCOME TO OUR WEBSITE, BARE IN MIND WE'RE STILL UNDER CONSTRUCTION</h2><p align="center">Take a look at our online Menu by pressing the Burger <core-icon icon="menu"></core-icon> Button above, or if you know exactly what you want call us now on <p><b><a href="tel:01179522233">(0117)9522233</a></b></p></p></div>
</post-card1></div>
<section class="section1" horizontal center-justified layout>
<h1>ADSENSE CODE GOES HERE</h1>
</core-header-panel>
</core-scroll-header-panel>
</section>
</core-drawer-panel>
</template>
最佳答案
今天(2017-05-05)刚测试过,广告在元素(Polymer 1)中运行良好,没有警告,示例代码如下:
<paper-card>
<div class="card-content">
<p>my content here</p>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- AutoSize -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-000000000"
data-ad-slot="000000000"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</paper-card>
关于html - Adsense 不适用于 Polymer 设计,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28011092/