protocol意义

1

var _bdhmProtocol =
 (("https:" == document.location.protocol) ? " https://" : " http://");

document.write(unescape("%3Cscript src='" + _bdhmProtocol +"hm.baidu.com/h.js%3F7bb9f12e5e3beab67267db2e
094585f1' type='text/javascript'%3E%3C/script%3E"));

参考博客:https://blog.csdn.net/gui951753/article/details/82227800
点这里进入
总结:首先protocol返回当前URL协议,当前URL如果等于https则返回https://,若不等于,则返回http://,这是为了方便用户查找到该网站。之后写的东西我目前也不知道,只知道unescape会将字符串中的%全部换为\。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章