홈 페이지로 설정 및 모음 가입

1698 단어
$("#addfav").click(function() { 
  var ua = navigator.userAgent.toLowerCase(),
    url =location.href,
    sitename =document.title; 
  if(ua.indexOf("msie 8")>-1){
      external.AddToFavoritesBar(url,sitename,"");//IE8
  }else{
    try{
      window.external.addFavorite(url,sitename);
    }catch(e){
      try{
      window.sidebar.addPanel(sitename,url,"");//firefox
      }catch(e){
      alert(" , Ctrl+D ");
      }
    }
  }
  return false;

});

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(" !
“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',vrl); }else{ alert(" , 。 "); } } }

  
 
html:
<span onclick="SetHome(this,window.location)" target="_self"> </span>

<span id="addfav"> </span>

좋은 웹페이지 즐겨찾기