Created
December 8, 2016 02:59
-
-
Save anonymous/23b3cc0442cd260af7ac4a91c8b76de7 to your computer and use it in GitHub Desktop.
demo: HTTPS 改造 // source http://jsbin.com/citocaz
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
<!DOCTYPE html> | |
<html lang="zh-Hans"> | |
<head> | |
<meta charset="UTFa-8" /> | |
<title>demo: HTTPS 改造</title> | |
<meta content="魅玩帮是一个提供智能硬件免费申请试玩的导购平台,我们筛选市面上最为前沿、时尚、实用和专业的硬件产品免费提供给用户进行试用,为其他用户在购买前提供有价值的决策参考。" name="description" /> | |
<meta content="魅玩帮,可穿戴, 可穿戴设备, 智能设备, 智能可穿戴设备, 便携设备, 便携智能设备, 奇酷网, 奇酷,360 奇酷, 小米酷玩, 点名时间,牛玩,魅族智能硬件, 智能硬件,硬件, 智能移动设备, 免费试用, 苹果,评测,测评, 智能手环, 智能家居, 智能手表, 智能电视 " name="keywords" /> | |
<meta content="True" name="HandheldFriendly" /> | |
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" /> | |
<meta content="width=device-width,initial-scale=1,maximum-scale=1" name="viewport" /> | |
<link href="http://res.wan.meizu.com/wan-res/favicon.ico" rel="shortcut icon" /> | |
<link href="http://res.wan.meizu.com/wan-res/min/styles/index.f644d1fc.css" rel="stylesheet" /> | |
<!--[if lt IE 9]> | |
<script src="http://cdnjscn.b0.upaiyun.com/libs/html5shiv/3.7.2/html5shiv.min.js"></script> | |
<script src="http://cdnjscn.b0.upaiyun.com/libs/respond.js/1.4.2/respond.min.js"></script> | |
<![endif]--> | |
</head> | |
<body> | |
<div class="app-download-hint"> | |
<div class="open wrapper"> | |
<img class="screen-shot" src="http://res.wan.meizu.com/wan-res/images/ss-hint-open.png" /> | |
<img class="slogon" src="http://res.wan.meizu.com/wan-res/images/dl-hint-open.png" /> | |
<a href="http://wan.meizu.com/about/download.html" class="download-btn">下载 APP</a> | |
<button class="close"></button> | |
</div> | |
<div class="close wrapper"> | |
<img class="screen-shot" src="http://wan-pro.b0.upaiyun.com/wan-res/images/ss-hint-close.png" /> | |
<button class="close"></button> | |
<a href="http://wan.meizu.com/about/download.html" class="download-btn">下载 APP</a> | |
<img class="slogon" src="http://res.wan.meizu.com/wan-res/images/dl-hint-close.png" /> | |
</div> | |
</div> | |
<script id="jsbin-javascript"> | |
var img = document.getElementsByTagName('img')[0]; | |
img.onload = function () { | |
console.log('load'); | |
}; | |
img.onerror = function () { | |
console.log('error'); | |
}; | |
var DOMAINS = { | |
"http://image.wan.meizu.com": "https://wan-img.res.meizu.com", | |
"http://res.wan.meizu.com" : "//wan.res.meizu.com", | |
"http://wan-pro.b0.upaiyun.com": "//wan-img.res.meizu.com", | |
"http://wan-dev.b0.upaiyun.com" : "//wan-dev.b0.upaiyun.com" | |
} | |
function replaceDomain(dom){ | |
var keys = Object.keys(DOMAINS); | |
for(var i=0;i < keys.length; i++){ | |
var reg = new RegExp(keys[i], 'g'); | |
dom = dom.replace(reg, DOMAINS[keys[i]]); | |
} | |
return dom; | |
} | |
// 模拟DOMContentLoaded | |
document.onreadystatechange = function () { | |
console.log(document.readyState); | |
if (document.readyState == "interactive") { | |
var html = document.getElementsByTagName('html')[0]; | |
html.innerHTML = replaceDomain(html.innerHTML); | |
} | |
} | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var img = document.getElementsByTagName('img')[0]; | |
img.onload = function () { | |
console.log('load'); | |
}; | |
img.onerror = function () { | |
console.log('error'); | |
}; | |
var DOMAINS = { | |
"http://image.wan.meizu.com": "https://wan-img.res.meizu.com", | |
"http://res.wan.meizu.com" : "//wan.res.meizu.com", | |
"http://wan-pro.b0.upaiyun.com": "//wan-img.res.meizu.com", | |
"http://wan-dev.b0.upaiyun.com" : "//wan-dev.b0.upaiyun.com" | |
} | |
function replaceDomain(dom){ | |
var keys = Object.keys(DOMAINS); | |
for(var i=0;i < keys.length; i++){ | |
var reg = new RegExp(keys[i], 'g'); | |
dom = dom.replace(reg, DOMAINS[keys[i]]); | |
} | |
return dom; | |
} | |
// 模拟DOMContentLoaded | |
document.onreadystatechange = function () { | |
console.log(document.readyState); | |
if (document.readyState == "interactive") { | |
var html = document.getElementsByTagName('html')[0]; | |
html.innerHTML = replaceDomain(html.innerHTML); | |
} | |
}</script></body> | |
</html> |
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
var img = document.getElementsByTagName('img')[0]; | |
img.onload = function () { | |
console.log('load'); | |
}; | |
img.onerror = function () { | |
console.log('error'); | |
}; | |
var DOMAINS = { | |
"http://image.wan.meizu.com": "https://wan-img.res.meizu.com", | |
"http://res.wan.meizu.com" : "//wan.res.meizu.com", | |
"http://wan-pro.b0.upaiyun.com": "//wan-img.res.meizu.com", | |
"http://wan-dev.b0.upaiyun.com" : "//wan-dev.b0.upaiyun.com" | |
} | |
function replaceDomain(dom){ | |
var keys = Object.keys(DOMAINS); | |
for(var i=0;i < keys.length; i++){ | |
var reg = new RegExp(keys[i], 'g'); | |
dom = dom.replace(reg, DOMAINS[keys[i]]); | |
} | |
return dom; | |
} | |
// 模拟DOMContentLoaded | |
document.onreadystatechange = function () { | |
console.log(document.readyState); | |
if (document.readyState == "interactive") { | |
var html = document.getElementsByTagName('html')[0]; | |
html.innerHTML = replaceDomain(html.innerHTML); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment