-
Notifications
You must be signed in to change notification settings - Fork 20
/
1.26 自动收藏当前页面.html
89 lines (79 loc) · 2.4 KB
/
1.26 自动收藏当前页面.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html PUBliC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<script type="text/javascript">
function addFav()
{
// 加入收藏夹
if (document.all)
{
window.external.addFavorite(window.location.href, document.title);
}
else if (window.sidebar)
{
window.sidebar.addPanel(document.title, window.location.href, "");
}
}
</script>
</head>
<body>
<a href="javascript:void(0)" onclick ="addFav()"> 加入收藏 </a>
</body>
</html>
<!--
<!DOCTYPE html PUBliC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<script type="text/javascript">
function addFav()
{
// 加入收藏夹
if (document.all)
{
window.external.addFavorite(window.location.href, document.title);
}
else if (window.sidebar)
{
window.sidebar.addPanel(document.title, window.location.href, "");
}
}
function setHomepage(){ // 设置首页
if (document.all) {
document.body.style.behavior = 'url(#default#homepage)';
document.body.setHomePage(window.location.href);
} else if (window.sidebar) {
if (window.netscape) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
} catch(e) {
alert("该操作被浏览器拒绝,如果想启用该功能,请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true");
}
}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage', window.location.href);
}
}
</script>
</head>
<body>
<a href ="javascript:void(0)" onclick ="setHomepage()"> 设为首页 </a>
<a href="javascript:void(0)" onclick ="addFav()"> 加入收藏 </a>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>onbeforeunload测试</title>
<script>
function checkLeave(){
event.returnValue="确定离开当前页面吗?";
}
</script>
</head>
<body onbeforeunload="checkLeave()">
<input type = "button" onclick = "window.opener=null;window.open( '','_self');window.close()"/>
</body>
</html>
-->
window.sidebar.addPanel
window.sidebar.addPanel(sTitle, sURL, "")