本文介绍了如何将Google Adsense放入GWT中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Do anyone know how to put Google adsense ads inside a GWT web application?

推荐答案

您可以将Adsense中的javascript代码放在GWT开头的单个HTML页面中.这样,广告将不会显示在与GTW相同的区域中,而是在GWT代码上方/下方显示.对于可以的广告.

You can put the javascript-code from Adsense in the single HTML page that GWT starts with. This way the advertising will not be displayed in the same area as GTW but above/below the GWT code. For advertising that could be ok.

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

This example places a baner above the application:

  <!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>

为了向Google WT表示可以信任Google adsense的站点,您需要在-whitelist命令行参数中添加一个正则表达式匹配的URL.

In order to indicate to Google WT that the site of Google adsense can be trusted you need to add a regex matching URL to the -whitelist command line argument.

请注意,这可能无法解决上述为什么我要丢弃GWT"文章中描述的问题.

Note that this will probably not solve the problems desribed in the above "Why I dumped GWT" article.

这篇关于如何将Google Adsense放入GWT中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 17:03