如何将Google Adsense放入GWT

Thi*_*niz 10 java gwt adsense

有谁知道如何将Google adsense广告放入GWT网络应用程序中?

Edw*_*win 3

您可以将 Adsense 中的 javascript 代码放入 GWT 启动的单个 HTML 页面中。这样广告就不会显示在与 GTW 相同的区域,而是显示在 GWT 代码的上方/下方。对于广告来说可能没问题。

此示例在应用程序上方放置一个横幅:

  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>www.javaoracleblog.com</title>
    <script type="text/javascript" language="javascript" src="com.javaoracleblog.aggregator.nocache.js"></script>
  </head>
  <body>
<script type="text/javascript"..
ADsense code here 
</script>
    <!-- OPTIONAL: include this if you want history support -->
    <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

为了向 Google WT 表明 Google adsense 网站是可信的,您需要将正则表达式匹配 URL 添加到 -whitelist 命令行参数中。

请注意,这可能无法解决上面“为什么我放弃 GWT”文章中描述的问题。