Native js programming is set to the home page compatible with ie firefox and Google
- 2020-03-30 03:14:22
- OfStack
Native js writing, compatible with ie, firefox and Google.
Complete code:
<script type="text/javascript">
//Set the home page as www.jb51.net
function SetHome(obj,url){
try{
obj.style.behavior='url(#default#homepage)';
obj.setHomePage(url);
}catch(e){
if(window.netscape){
try{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
}catch(e){
alert(" Sorry, this operation was rejected by the browser! nn Please enter" about:config "And press enter and then will [signed.applets.codebase_principal_support] Set to 'true'");
}
}else{
alert(" Sorry, the browser you are using is unable to complete this operation. nn You need to manually "+url+" Set as home page. ");
}
}
}
//www.jb51.net
function AddFavorite(title, url) {
try {
window.external.addFavorite(url, title);
}
catch (e) {
try {
window.sidebar.addPanel(title, url, "");
}
catch (e) {
alert(" Sorry, the browser you are using is unable to complete this operation. nn Failed to add favorites, please enter the new site after use Ctrl+D add ");
}
}
}
</script>
<a href="javascript:void(0);" onclick="SetHome(this,'//www.jb51.net ');"> Set home </ a>
<div class="text text2"><a href="javascript:void(0);" onclick="AddFavorite(' The home of the script ','//www.jb51.net')"> closed hidden this standing </a>