js代码 设为首页 加入收藏
来源:互联网 发布:latex windows 编辑:程序博客网 时间:2024/06/05 04:54
<!-- 设为首页 --><li><a href="javascript:setHome(this,window.location)"> <span class="glyphicon glyphicon-home"></span> <b>设为首页</b></a></li><!-- 加入收藏 --><li><a href="javascript:addFavorite()"> <span class="glyphicon glyphicon-heart"></span> <b>加入收藏</b></a></li>
<script type="text/javascript"> function addFavorite() { var url = window.location; var title = document.title; var ua = navigator.userAgent.toLowerCase(); if (ua.indexOf("msie 8") > -1) { external.AddToFavoritesBar(url, title, '');//IE8 } else { try { window.external.addFavorite(url, title); } catch (e) { try { window.sidebar.addPanel(title, url, "");//firefox } catch (e) { alert("加入收藏失败,请使用Ctrl+D进行添加"); } } } } //设为首页 <a onclick="setHome(this,window.location)">设为首页</a> 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>
阅读全文
0 0
- 设为首页和加入收藏(js代码)
- 加入收藏 设为首页js代码
- js代码 设为首页 加入收藏
- 设为首页,和加入收藏js代码
- js代码 设为首页 加入收藏
- js代码 设为首页 加入收藏
- js 设为首页 加入收藏
- js 加入收藏,设为首页
- js加入收藏设为首页
- 设为首页/加入收藏代码
- 设为首页/加入收藏代码
- 设为首页|加入收藏代码
- 加入收藏 设为首页 代码
- 设为首页/加入收藏 代码
- 设为首页加入收藏代码
- 设为首页/加入收藏代码
- 设为首页 加入收藏代码
- 设为首页代码和加入收藏JS代码(未测试)
- ReactNative,第一次运行的时候报错InstallException
- POJ 2348 Euclid's Game
- 关于动态权限申请的一点总结
- 【HDU
- CodeForces
- js代码 设为首页 加入收藏
- JavaWeb中的Spring概述
- window 10 Protocol v3.3.0 版本编译即使用
- Unity 层遮罩
- 浅谈Android应用建项目结构
- [RK3288][Android6.0] WiFi之NetworkAgent对评分的更新
- windows下安装AnyProxy抓取移动App Http请求
- 关于学习UE交互设计的3个建议
- POJ 1061 青蛙的约会 extend GCD +找点