几个JavaScript代码

2018年4月11日 | 分类: 【技术】

【使用JavaScript代码修改网页标题】

http://www.cnblogs.com/imhurley/archive/2012/03/14/2395720.html
http://www.jb51.net/article/129504.htm
http://moon-soft.com/program/WEB/javascript/article/other/166.htm
http://xmllong.blog.163.com/blog/static/2963566920091051239563/
http://www.cnblogs.com/zjfree/archive/2011/10/20/2219123.html

http://www.cnblogs.com/amylis_chen/archive/2010/07/08/1773335.html

获取当前文件全路径:

<script language="javascript">
alert(window.location.href);
alert(window.location);
alert(location.href);
alert(parent.location.href);
alert(top.location.href);
alert(document.location.href);
alert(document.URL);
</script>

获取当前目录方法:

<script type="text/javascript">
//方法一
var str = location.href;
var arr = str.split("/");
delete arr[arr.length-1];
var dir = arr.join("/");
alert(dir);
//方法二
alert(location.href.substring(0,location.href.lastIndexOf('/')));
</script>

获取当前文件名:

<script type="text/javascript">
var filename=location.href;
filename=filename.substr(filename.lastIndexOf('/')+1);  
alert(filename);  
</script>

【怎样混淆JavaScript代码】

参考:https://www.zhihu.com/question/47047191

参考:https://github.com/caiguanhao/js-obfuscator
参考:https://github.com/FF-Mercurial/ug

参考:https://www.danstools.com/javascript-obfuscate/
参考:http://www.cnblogs.com/ChandlerVer5/p/Javascript_compressor.html
参考:https://blog.csdn.net/nh18304030935hn/article/details/54571682

参考:https://www.css-js.com/tools/compressor.html?tab=babel
参考:https://tool.lu/js/
参考:http://tool.oschina.net/jscompress