为什么有些网站(或提供客户端javascript代码的广告客户)采用了在通话中拆分<script>和/或</script>标记的技术document.write()?
我注意到亚马逊也这样做了,例如:
<script type='text/javascript'>
if (typeof window['jQuery'] == 'undefined') document.write('<scr'+'ipt type="text/javascript" src="http://z-ecx.images-amazon.com/images/G/01/javascripts/lib/jquery/jquery-1.2.6.pack._V265113567_.js"></sc'+'ript>');
</script>
Run Code Online (Sandbox Code Playgroud) 鉴于关于同一主题的其他问题,我觉得我理解将<script>标记连接'<scr'+'ipt..'在javascript字符串中的明显理由,即使这本身是错误的.
然而,在寻找的代码Instapaper的书签我看d.createElement('scr' + 'ipt').代码的相关部分(美化)在问题的最后.
即使这个(反)模式是为了避免HTML解析器在<script>javascript字符串中发生结束标记之后在标记处徘徊,我可以看到更少的理由这样做,因为连接文本甚至不代表<script>标记.
在这种情况下,这是出于其他原因吗?
javascript: function iprl5() {
var d = document,
z = d.createElement('scr' + 'ipt'), //???
b = d.body,
l = d.location;
Run Code Online (Sandbox Code Playgroud)