如何缩小 Google AdSense JS?
每当我缩小从 Google 获得的 AdSense 脚本时,它就会停止工作。有什么想法吗?
原始代码:
<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}
标签完成的。
Whenever I minify the AdSense script I got from Google, it stops working. Any ideas why?
Original Code:
<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">
Minified Code:
<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>
The minification is being done by Smarty's {strip}
tags.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
问题在于第一个脚本标签开头和结尾的 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
我认为你遗漏了这一部分:
i think you left out this part:
尝试删除
希望有帮助
Try to remove the
<!--
Hope it helps
它将是
要么删除它,要么添加一个换行符,即
虽然我看不出这里的缩小会给你带来什么——没有任何东西可以重命名或压缩。
It'll be the
<!--
- this can mean 'treat this line as a comment'. It's an old compatibility hack for browers that didn't support JavaScript.Either remove it or add a linebreak afterwards, i.e.
though I can't see what minifying here is gaining you - there's nothing that can be renamed or compressed.
请注意:
Look out for this:
<!--
and-->