哪里是在这个code中的.js文件?他们为什么叫它这样? [英] Where is the .JS file in this code? And why are they calling it this way?
本文介绍了哪里是在这个code中的.js文件?他们为什么叫它这样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
哪里JS文件,这是异步调用JS的最快方法?
我想那么他们有PHP调用在.JS用于更新广告统计??
在code:
<脚本类型=文/ JavaScript的>
(功能(){
VAR ACC =acc_230d269_pub;
VAR ST =nocss;
变种或=H;
变种E = document.getElementsByTagName(剧本)[0];
变种D =使用document.createElement(脚本);
d.src =(的https:== document.location.protocol的https://:HTTP://)+engine.influads.com/show/+或+/+ ST + /+ ACC;
d.type =文/ JavaScript的;
d.async = TRUE;
d.defer = TRUE;
e.parentNode.insertBefore(D,E);
})();
< / SCRIPT>
解决方案
我做你的code的可读:
1 LT;脚本类型=文/ JavaScript的>
2(函数(){
3 VAR ACC =acc_230d269_pub;
4 VAR ST =nocss;
5变种或=H;
6变种E = document.getElementsByTagName(剧本)[0];
7变种D =使用document.createElement(脚本);
8 d.src =(的https:== document.location.protocol的https://:HTTP://)+
9engine.influads.com/show/+或+/+ ST +/+ ACC;
10 d.type =文/ JavaScript的;
11 d.async = TRUE;
12 d.defer = TRUE;
13 e.parentNode.insertBefore(D,E);
14})();
15℃/脚本>
- 2,14一个匿名函数包装被创建的,所以变量不能从函数外部访问(范围)
- 3 
ACC
看起来像广告的标识符 - 4,5
ST =nocss
和或=H
看起来像设置调整外观 - 7,10-12 A
<脚本>的创建
标记。异步
=加载脚本将不会阻止文件的执行。推迟= TRUE
$ P $从没有被执行pvents脚本(可省略) - 6,13新创建的脚本标签之前插入的(13)的文件中的第一个脚本标记的(6,13)的
- 8,9的URL构造:
如果当前页面是通过安全连接传输,注入脚本也将通过HTTPS协议传输
所需的文件的扩展名被省略。此文件可以使用应用程序/ JavaScript的
MIME类型由服务器配置提供服务。
Where is the JS file and is this Async the fastest way to call JS?
I guess they then have PHP calls in the .JS for updating the Ad stats??
The code:
<script type="text/javascript">
(function(){
var acc = "acc_230d269_pub";
var st = "nocss";
var or = "h";
var e = document.getElementsByTagName("script")[0];
var d = document.createElement("script");
d.src = ('https:' == document.location.protocol ?'https://' : 'http://')+"engine.influads.com/show/"+or+"/"+st+"/"+acc;
d.type = "text/javascript";
d.async = true;
d.defer = true;
e.parentNode.insertBefore(d,e);
})();
</script>
解决方案
I've made your code more readable:
1 <script type="text/javascript">
2 (function () {
3 var acc = "acc_230d269_pub";
4 var st = "nocss";
5 var or = "h";
6 var e = document.getElementsByTagName("script")[0];
7 var d = document.createElement("script");
8 d.src = ('https:' == document.location.protocol ? 'https://' : 'http://') +
9 "engine.influads.com/show/" + or + "/" + st + "/" + acc;
10 d.type = "text/javascript";
11 d.async = true;
12 d.defer = true;
13 e.parentNode.insertBefore(d, e);
14 })();
15 </script>
- 2,14 An anonymous function wrapper is created, so that variables cannot be access from outside the function ("scope")
- 3
acc
looks like the identifier of the advertiser - 4,5
st = "nocss"
andor = "h"
looks like settings to adjust the appearance - 7,10-12 A
<script>
tag is created.async
= Loading the script will not block the execution of the document.defer=true
prevents the script from not being executed (can be omitted) - 6,13 The newly created script tag is inserted before (13) the first script tag in the document (6,13)
- 8,9 The URL is constructed:
If the current page is transmitted over a secure connection, the injected script will also be transferred over the HTTPS protocol.
The extension of the requested file is omitted. This file could be served using the application/javascript
MIME type by server configuration.
这篇关于哪里是在这个code中的.js文件?他们为什么叫它这样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文