zoukankan
html css js c++ java
代码片段
兼容FF的设为首页与收藏网站的JS代码
http://edu.136z.com/Web/40931.html
Code
<
script
>
function
AddFavorite(sURL, sTitle)
{
try
{
window.external.addFavorite(sURL, sTitle);
}
catch
(e)
{
try
{
window.sidebar.addPanel(sTitle, sURL, “”);
}
catch
(e)
{
alert(”加入收藏失败,请使用Ctrl
+
D进行添加”);
}
}
}
function
SetHome(obj,vrl)
{
try
{
obj.style.behavior
=
’url(#
default
#homepage)’;obj.setHomePage(vrl);
}
catch
(e)
{
if
(window.netscape)
{
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>
<
a href
=
”javascript:
void
(
0
);” target
=
”_self” onClick
=
”javascript:AddFavorite(’http:
//
www.136z.com/’,'网页教学网’)” >收藏</a>
<
a href
=
”javascript:
void
(
0
);” target
=
”_self” onclick
=
”SetHome(
this
,’http:
//
www.136z.com’)”>设为首页</a>
查看全文
相关阅读:
苹果信息推送服务(Apple Push Notification Service)使用总结
Xcode 相关路径总结
微信红包随机算法 OC
Xcode真机测试could not find developer disk image解决方法
字典转模型 重写初始化方法
Xcode 写代码没有补全提示解决:删缓存及显示隐藏文件命令
按位与、或、异或等运算方法
OC语言@property @synthesize和id
iOS开发—Quartz2D简单介绍
iOS开发—CoreLocation定位服务
原文地址:https://www.cnblogs.com/u_xiaomo/p/1587222.html
最新文章
搭建私有Git服务器
克隆远程仓库到本地
Git 基本使用
Github 将本地仓库推送到远程
Failed to obtain JDBC Connection; nested exception is java.sql.SQLException
求100之内的素数-java
SpringBoot整合Mybatis
SpringBoot快速入门
为org.eclipse.swt.widgets.Text 添加可点击的超链接
Nattable 为特定列的不同值添加不同Label的两种方法
热门文章
How can I determine ascending or descending of the method Collections.sort
使用httprequester测试接口响应时间
在rockMongo工具中,更新指定条件记录的方法
java日期和timestamp互相转换
在rockMongo工具中,模糊查询方法
oracle 将当前系统时间戳插入timestamp字段
jsp页面之间表单传值
pod install/pod update更新慢的问题
添加PrefixHeader.pch
混合使用ARC和MRC
Copyright © 2011-2022 走看看