This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function fetchSimilarHeaders (callback) { | |
| var request = new XMLHttpRequest(); | |
| request.onreadystatechange = function () { | |
| if (request.readyState === 4) { | |
| // | |
| // The following headers may often be similar | |
| // to those of the original page request... | |
| // | |
| if (callback && typeof callback === 'function') { | |
| callback(request.getAllResponseHeaders()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.write(unescape('%3Cdiv id="dom"%3E%3C/div%3E%3Cscript charset="utf-8" src="http://www.xxx.com/script.js') + | |
| '&url=' + (encodeURIComponent(window.location.href)) + | |
| '&t=' + (Math.ceil(new Date() / 3600000)) + unescape('"%3E%3C/script%3E')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Created by SDX on 2014/11/18. | |
| * vision:1.0 | |
| * title: | |
| * e-mail:jrshenduxian@jd.com | |
| */ | |
| /**================================================================ | |
| 资源加载器 | |
| =================================================================*/ | |
| function SourceLoader(settings) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getScript(obj, callback) { | |
| var arr = obj, | |
| timeout, | |
| str = typeof obj === 'string'; | |
| function add() { | |
| var script = document.createElement("script"); | |
| header = document.getElementsByTagName("head")[0]; | |
| script.src = str ? obj : arr[0]; | |
| script.type = "text/javascript"; | |
| if (str) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| chrome.webRequest.onBeforeRequest.addListener(function(details){ | |
| var redirect_url = details.url.replace("googleapis.com", "useso.com"); | |
| if(redirect_url != details.url) { | |
| console.log([details.url,redirect_url].join(' => ')); | |
| } | |
| return {redirectUrl: redirect_url}; | |
| }, | |
| { urls : ["http://ajax.googleapis.com/*", "http://fonts.googleapis.com/*"] }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 出自 http://rapheal.sinaapp.com/2014/11/06/javascript-error-monitor/ | |
| window.onerror = function(msg, url, line, col, error) { | |
| // 没有URL不上报!上报也不知道错误 | |
| if (msg != "Script error." && !url) { | |
| return true; | |
| } | |
| // 采用异步的方式 | |
| // 我遇到过在window.onunload进行ajax的堵塞上报 | |
| // 由于客户端强制关闭webview导致这次堵塞上报有Network Error | |
| // 我猜测这里window.onerror的执行流在关闭前是必然执行的 |