如何缩小Google AdSense JS? [英] How to Minify Google AdSense JS?

查看:128
本文介绍了如何缩小Google AdSense JS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我缩小从Google获得的AdSense脚本时,它就会停止工作。有什么想法吗?

Whenever I minify the AdSense script I got from Google, it stops working. Any ideas why?

原始代码:

<script type="text/javascript"><!--
google_ad_client = "xxx";
/* Ad 1 */
google_ad_slot = "2668798369";
google_ad_width = 160;
google_ad_height = 600;
//-->

</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">

缩小代码:

<script type="text/javascript"><!--google_ad_client = "xxx";/* Ad 1 */google_ad_slot = "2338787596";google_ad_width = 200;google_ad_height = 200;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

缩小是由Smarty的 {strip} tags。

The minification is being done by Smarty's {strip} tags.

推荐答案

问题是第一个脚本标记开头和结尾的HTML注释标记。你不需要它们,它们只是在那里解决Netscape 1.0

The problem is the HTML comment tags at the start and end of the first script tag. You don't need them, they're just there to work around Netscape 1.0

尝试用这个替换你的缩小脚本

Try replacing your minified script with this

<script type="text/javascript">google_ad_client="xxx";google_ad_slot="2668798369";google_ad_width=160;google_ad_height=600;</script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js">

这篇关于如何缩小Google AdSense JS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆