function addFav(){  // 加入收藏夾 if (document.all){ window.external.addFavorite(window.location, document.title); }else if (window.sidebar){ window.sidebar.addPanel(document.title, window.location, ""); } } function setHomepage(){  // 設置首頁 if (document.all){ document.body.style.behavior = 'url(#default#homepage)'; document.body.setHomePage(window.location); }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', 'http://www.bjfao.gov.cn'); } } /** * *服務器端 * */ function transToBig5(){ var protocol = window.location.protocol; var url = window.location.host; var href = window.location.pathname; if(href.indexOf("/ft")!=-1){ return; }else{ var newUrl = "/ft" + href; window.location.href =protocol+"//"+url+newUrl; } } function transBack(){ var protocol = window.location.protocol; var url = window.location.host; var href = window.location.pathname; var index = href.indexOf("/ft"); var newUrl = ""; if(index!=-1){ newUrl= href.replace("/ft",""); }else{ newUrl = href; } window.location.href =protocol+"//"+url+newUrl; } /** *本地閱覽時的繁簡體切換 * */ function transToBig5ForLocal(){ var protocol = window.location.protocol; var url = window.location.host; var href = window.location.pathname; if(href.indexOf("/localView/ft")!=-1){ return; }else{ var newUrl = href.replace("/localView","/localView/ft"); window.location.href =protocol+"//"+url+newUrl; } }