-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path设置为首页.html
39 lines (37 loc) · 1.15 KB
/
设置为首页.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
35
36
37
38
39
<!DOCTYPE html>
<html>
<head>
<title>设为首页</title>
<meta charset="UTF-8" />
</head>
<body>
<a onclick="SetHome(this,window.location)" style="cursor:hand">设为首页</a>
<script>
function SetHome(obj, vrl) {
try {
console.log(obj.__proto__)
obj.style.behavior = "url(#default#homepage)";
obj.setHomePage(vrl);
} catch (e) {
console.log('wwew')
if (window.netscape) {
console.log(eqwe)
try {
netscape.security.PrivilegeManager.enablePrivilege(
"UniversalXPConnect"
);
} catch (e) {
alert(
"此操作被浏览器拒绝!\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为'true'"
);
}
var prefs = Components.classes[
"@mozilla.org/preferences-service;1"
].getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref("browser.startup.homepage", vrl);
}
}
}
</script>
</body>
</html>