Why split the lt;scriptgt; tag when writing it with document.write()?(为什么要拆分 lt;scriptgt;用 document.write() 编写时标记?)
问题描述
为什么某些网站(或向客户提供 javascript 代码的广告商)采用将 <script>
和/或 </script>
标记拆分的技术在 document.write()
调用中?
Why do some sites (or advertisers that give clients javascript code) employ a technique of splitting the <script>
and/or </script>
tags up within document.write()
calls?
我注意到亚马逊也这样做,例如:
I noticed that Amazon does this as well, for example:
<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>
推荐答案
</script>
必须分解,否则会结束封闭的
本文标题为:为什么要拆分 <script>用 document.write() 编写时标记?


基础教程推荐
- 如何添加到目前为止的天数? 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01