Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ajax IFRAME中的Adsense_Ajax_Iframe_Adsense - Fatal编程技术网

Ajax IFRAME中的Adsense

Ajax IFRAME中的Adsense,ajax,iframe,adsense,Ajax,Iframe,Adsense,大家好, 我已经创建了一个完全基于AJAX的web应用程序,但是Adsense似乎无法为AJAX交付的内容生成任何相关的广告 为了显示相关的广告,我创建了一个I-Frame,它将显示一个缓存文件,其中包含一个html格式的AJAX获取内容的硬拷贝,并包含adsense.js脚本 下面是一个例子: adsenseexample.html <html> <head> <title>User Cache</title> </head>

大家好, 我已经创建了一个完全基于AJAX的web应用程序,但是Adsense似乎无法为AJAX交付的内容生成任何相关的广告

为了显示相关的广告,我创建了一个I-Frame,它将显示一个缓存文件,其中包含一个html格式的AJAX获取内容的硬拷贝,并包含adsense.js脚本

下面是一个例子:

adsenseexample.html 


<html>
<head>
<title>User Cache</title>
</head>
<body>
<div style="height:200px;">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-xxxxxxxxxxxxxx";
google_ad_slot = "xxxxxxxxxxxxx";
google_ad_width = 200;
google_ad_height = 200;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
(This is where the cached content is. It's not visible to the user but 
a complete duplicate of what they are viewing. It's in
 plain text with no pictures for faster loading).
</head>
</body>
adsenseexample.html
用户缓存
(这是缓存内容所在的位置。它对用户不可见,但
他们正在查看的内容的完整副本。在
纯文本,无图片,加载速度更快)。
加载到iframe中的:

<iframe src="adsenseexample.html"> </iframe>

有人知道为什么我仍然没有得到任何相关的广告。这种方法从一开始就有缺陷吗


谢谢

这是一篇文章中有趣的讨论,似乎解决了这个问题


注意:我没有试过,虽然那个家伙说他这个解决方案是谷歌提出的,但我会发邮件给他们,因为至少我不知道它是否违反了TOS,你有没有试过将参数传递给你的iframe src,比如关键字,来自转介http请求的描述?然后,您需要将关键字param和description添加到meta标记中。

谷歌在其ToS中声明iFrame不可与Adsense一起使用。

等等,所以广告出现了,但它们似乎不相关?是的,就是这样。例如,我创建了一个测试帐户,其中包含由AJAX提供的有关计算机/技术的内容。正如我上面解释的,adense.html将包含所有内容的纯文本版本,并加载到IFRAME中。不幸的是,我看到的不是相关的广告,而是基于非AJAX交付的内容(如站点名称)的广告。