stay tuned: 我发现还有两点要补充,近期本文会更新。
用 android 的人应该都看过这个画面 (链接例子,在 android 开才有效果):
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiG9nnhXOS2wbkV0zHXlIxX1_ePUoMYF8C_NbGTddvurLi70vUqWEydnZEJgXsIvXl7-w8gnUqNMcc3hN3VAZlG8svvktskEAKtlkXZYN8zHqZR-pnLPycs7AvbVsnLO8yndxzollntvwY/s1600/1468870974_2016-07-19_MQVXUBHttb.png)
按 OK 后就会开始不停振动:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzBYKZLkntzHTly5BnXI-tCQ_NQWMm5zmfPL8LgnlEby_34FhiXxWKl6wqYZO7puFp1PKDNgjE9cHiEaeiD-RX-7SiMq8LSQ1hMNhyphenhyphen1xKt-OHIUAHvJnCjbsQWLfNouOgNkzryiTZEtqw/s1600/1468870996_2016-07-19_pYxGAgxj6x.png)
如果按 back 出去前一页... 哎哟,按不出去叻,而且振到更厉害,除非直接关掉整个 tab, 但是之前的 history 就要重新找过, 如果是 incognito tab 就没有 history 可找:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgs-jabQ4BnFNE9ora9SkmGNZA_y601kBi3m3U9kgSruThQEwLSbMKqvsmb6u2grHXeMdB8lWtKIYmxJrL-GqQEtQJEqTvK82pKr6rKHWR-zQfL14eRrW-hd752KKrdGqCLENGDfxoSgZg/s1600/1468871168_2016-07-19_o0LZwKzji1.png)
有些小白会选择关机甚至 format。所以这篇文是想澄清这种误导。
真相是,这种网站只要略懂 html (navigator.vibrate) 皮毛的人都做得出的,拿这是我的 sample, http://limkokhole.github.com :
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-Mf1Fr0uQuFtszMKHfzbpAy1J_Uvdfmt4-NbLLmzXtyVMQArqZ-EuKrlBXc1IJM7ZHjDvXjNZpevIQ0BE6krFNTu-WkbUJNrUf4OJAZqtkQUhLRTY8OZXy1MOZcfj-S6eTzlJ2xDVKcg/s1600/1468871572_2016-07-19_Yp8qJTCbcq.png)
赶时间编写的(都是靠 stackoverflow),做得不是很好,opera 浏览器好像不 work, 按非常快有机会逃脱回上一页,timer 字也小,哈哈...
源代码:
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script type='text/javascript' src="//wurfl.io/wurfl.js"></script> <script type="text/javascript"> jQuery(document).ready(function($) { if (window.history && window.history.pushState) { $(window).on('popstate', function() { var hashLocation = location.hash; var hashSplit = hashLocation.split("#!/"); var hashName = hashSplit[1]; if (hashName !== '') { var hash = window.location.hash; if (hash === '') { //alert('Back button was pressed.'); location.reload(false); } } }); window.history.pushState('forward', null, null); } }); function lala() { document.body.innerHTML = "<button width=\x22150%\x22 type=\x22submit\x22 onclick=\x22javascript:location.href='https://play.google.com/store/apps/details?id=com.nianticlabs.pokemongo&hl=en'\x22><img src=\x22http://s35.podbean.com/pb/89d7273bc6ae276b8927b6cad83ab32e/578cfa0c/data2/blogs60/771188/uploads/googlePlay-logo.png\x22 style=\x22height:200px;width:200px\x22 alt=\x22Submit\x22></button><div><span id=\x22time\x22></span></div>"; isVibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate; if (isVibrate) { navigator.vibrate([1000, 500, 1000, 500, 1000, 500, 1000, 500, 1000]); } function startTimer(duration, display) { var start = Date.now(), diff, minutes, seconds; function timer() { // get the number of seconds that have elapsed since // startTimer() was called diff = duration - (((Date.now() - start) / 1000) | 0); // does the same job as parseInt truncates the float minutes = (diff / 60) | 0; seconds = (diff % 60) | 0; minutes = minutes < 10 ? "0" + minutes : minutes; seconds = seconds < 10 ? "0" + seconds : seconds; display.textContent = "剩余: " + minutes + ":" + seconds + " 分钟!"; if (diff <= 0) { // add one second so that the count down starts at the full duration // example 05:00 not 04:59 start = Date.now() + 1000; } }; // we don''t want to wait a full second before the timer starts timer(); setInterval(timer, 1000); } var threeMinutes = 60 * 3, display = document.querySelector('#time'); startTimer(threeMinutes, display); var deviceModel = WURFL.complete_device_name; var onl = "警告!\n\n你的 " + deviceModel + " 感染了病毒并且电池已经损坏!\n\n请关闭此对话框, 3 分钟内下载 repair app 修复 。\n\n**如不修复,请自行承担风险**" setTimeout(function(){ alert(onl); }, 1000); } window.onload = lala; </script> </head> <body> <div><span id="time"></span></div> </body> </html>
那么,这些网站的目的是什么 ? 我观察了一下,大概主要是:
1. 让你下载没有验证的 apk 病毒。不是从 Google play 下载。或者假网站弄到很像 Google Play 也有可能的哦。
2. 让你 subscribe 很难 unsubscribe 的 SMS 付费服务。
3. 让你下载有合作关系的 Google play app 然后赚广告收入。
其实这种 html api 广泛的滥用,很多人投诉 liao de,比如说:
1. google chromium project,https://bugs.chromium.org/p/chromium/issues/list?q=navigator.vibrate, 但是不懂几时会完全 fix: 。
2. 至于 firefox, 已经是 fixed liao 的: https://bugzilla.mozilla.org/show_bug.cgi?id=124343 。如果现在测试,还是没有问 permission 的,
解决振动方法:
1. 用 firefox 的话,首先在地址栏输入 about:config ,在 search 那里输入 vibrat 字眼就能找到 dom.vibrator.enabled。默认是 true 的。按它会有 Toggle 按扭出现,再按就能改成 false。如果没有 dom.vibrator.enabled 的话,请确保你 update 你的 firefox app。
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkIHCNP9Meh1sxYkkL2as-vTM121SzvA1Fzc5XdLDx30H6bImS3s_8CZWtLjFUW7wfw4Uf3-tjVpVW5gE-aCQtcS-kCy2n9pAC4UI539f5ZifGoTdQN1cfcqiqobHANoOGjTWUjvUczd0/s1600/1468873043_2016-07-19_7R1lmHlZbD.png)
2. 使用 opera mini 。去 Google play 下载要看清楚哦,是 opera mini,不是 opera 哦, opera 那个还是会振动的哦。
3. 如果你手机已经 root, 取决于手机牌子,可能可以轻易地 disable vibrate, 比如 chmod 000 /sys/class/timed_output/vibrator/enable, 我手机没 root 无法去试验。
4. 珍爱生命,暂时远离 chrome。
5. fb 也是中。别忘了改 fb App Settings 设定那里改 Links open externally,然后把默认浏览器改成 firefox 或 opera mini:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3VhvVhuv-S4i_avIXmrKYDfaGQ3U8WX4pzFU6BSvaPdc02WkxAPUu_1LDPGU44FDlYoL1fqG8duqtISAzCukfjQdso3dSUmNeLbDiVpFimcXDczgBys5Q3lKHeit8KvMfJxRI3yN6TyI/s1600/1468874189_2016-07-19_xmo8AmTGZH.png)
去 Settings -> Apps -> Advanced -> Default app settings -> Browser -> 点选 Opera mini 或 Firefox (The four classic 纯粹乱入):
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUhfgfBeI_B8JnUvEiObxzHPrWSlIovTRqxDCGiuXRauAsM7wELaM_wh3WU7zHVBC2dNVlENwBRoEcpx1loab0FITeYx_NFhuQIfMOI_Jrh7LXODGVfhqTWEcMoAx-xmYtsvCmzmFP4Hc/s1600/1468874593_2016-07-19_FmdbgQKfhI.png)
这样一来,以后那些网站最多只能 pop up 吓唬人的信息, 起码不会振动振到你手麻哟~
No comments:
Post a Comment