|
@@ -257,4 +257,94 @@
|
|
|
|
|
|
</body>
|
|
|
|
|
|
+<!-- <script>
|
|
|
+ console.log(111111111111)
|
|
|
+ // var href = "http://www.baidu.com"
|
|
|
+ var href = "http://localhost:3000"
|
|
|
+ // 1.
|
|
|
+ // avueData()
|
|
|
+ // function avueData() {
|
|
|
+ // console.log(11123686)
|
|
|
+
|
|
|
+ // if (window.ActiveXObject === undefined) {// 不是ie浏览器,可直接打开
|
|
|
+ // window.open(href, '_blank');
|
|
|
+ // } else {// 是ie浏览器,跳转打开chrome
|
|
|
+ // var objShell = new ActiveXObject("WScript.Shell");
|
|
|
+ // objShell.Run("cmd.exe /c start chrome " + href, 0, true);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ // 2.
|
|
|
+ window.onload = function () {
|
|
|
+ var is_chrome = /chrome/.test(navigator.userAgent.toLowerCase());
|
|
|
+ // 判断是否谷歌浏览器
|
|
|
+ if (!is_chrome) {
|
|
|
+ console.log(!is_chrome)
|
|
|
+ console.log('1',href)
|
|
|
+ // setTimeout(toGG(href), 100);
|
|
|
+ } else {
|
|
|
+ console.log('2',href)
|
|
|
+ // window.location.replace(href)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function toGG(url) {
|
|
|
+ //创建ActiveXObject实例,只在IE下有效,才可以创建
|
|
|
+ var objShell = new ActiveXObject("WScript.Shell");
|
|
|
+ var x = getChromePath(objShell);
|
|
|
+ if (!x) {
|
|
|
+ alert("当前没有Chrome浏览器,请先安装Chrome浏览器");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ 命令参数说明
|
|
|
+ cmd.exe /c dir 是执行完dir命令后关闭命令窗口。
|
|
|
+ cmd.exe /k dir 是执行完dir命令后不关闭命令窗口。
|
|
|
+ cmd.exe /c start dir 会打开一个新窗口后执行dir指令,原窗口会关闭。
|
|
|
+ cmd.exe /k start dir 会打开一个新窗口后执行dir指令,原窗口不会关闭。
|
|
|
+ 这里的dir是start chrome www.baidu.com//用谷歌浏览器打开百度
|
|
|
+ */
|
|
|
+ console.log(url)
|
|
|
+ objShell.Run("cmd.exe /c start chrome " + url, 0, true);
|
|
|
+ }
|
|
|
+ function getChromePath(objShell) {
|
|
|
+ var regPath = ["HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Google Chrome\\InstallLocation",
|
|
|
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Google Chrome\\InstallLocation",
|
|
|
+ "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Google Chrome\\InstallLocation",
|
|
|
+ "HKEY_CURRENT_USER\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Google Chrome\\InstallLocation",
|
|
|
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\chrome.exe\\Path",
|
|
|
+ "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\chrome.exe\\Path",
|
|
|
+ ];
|
|
|
+
|
|
|
+ // 判断是否安装谷歌浏览器
|
|
|
+ for (var i = 0; i < regPath.length; i++) {
|
|
|
+ try {
|
|
|
+ var x = objShell.regRead(regPath[i]);
|
|
|
+ if (x) {
|
|
|
+ return x;
|
|
|
+ }
|
|
|
+ } catch (e) { }
|
|
|
+ }
|
|
|
+ return undefined;
|
|
|
+ };
|
|
|
+
|
|
|
+ // 3.
|
|
|
+ // var objShell = new ActiveXObject("WScript.Shell");
|
|
|
+
|
|
|
+ // objShell.Run("cmd.exe /c start chrome http://192.168.31.43:3000", 0, true);
|
|
|
+
|
|
|
+ // function redirectToGoogle() {
|
|
|
+ // var userAgent = window.navigator.userAgent;
|
|
|
+ // var isChrome = /Chrome/.test(userAgent);
|
|
|
+ // var ipAddress = '192.168.31.43:3000'; // 获取用户的IP地址,这部分需要借助服务器端的技术实现
|
|
|
+
|
|
|
+ // if (isChrome && ipAddress) {
|
|
|
+ // var googleURL = 'https://www.google.com' + '?ip=' + ipAddress;
|
|
|
+ // window.location.href = googleURL;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ // redirectToGoogle();
|
|
|
+
|
|
|
+</script> -->
|
|
|
+
|
|
|
</html>
|