forked from uku/Unblock-Youku
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackground.html
34 lines (30 loc) · 938 Bytes
/
background.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!doctype html>
<script>
ip_addr = "166.111.";
ip_addr += Math.floor(Math.random() * 255);
ip_addr += '.';
ip_addr += Math.floor(Math.random() * 254 + 1); // 1 ~ 254
chrome.webRequest.onBeforeSendHeaders.addListener(
// callback function
function(details) {
details.requestHeaders.push({
name: "X-Forwarded-For",
value: ip_addr
});
return {requestHeaders: details.requestHeaders};
},
// url filters
{
urls: [
"http://*.youku.com/*",
"http://*.tudou.com/*",
"http://tudou.letv.com/*",
"http://*.tudou.letv.com/*",
"http://*.xiami.com/*"
]
},
// extraInfoSpec
// the request is blocked until the callback function returns
["requestHeaders", "blocking"]
);
</script>