2012-11-27 46 views
1

改變瀏覽器的主頁我將此代碼添加到文件的prefs.js:如何通過VB.NET

user_pref("browser.startup.homepage", "http://www.google.com/"); 

它不工作。 Firefox打開通常的頁面。

+1

人們能夠設置thier自己的主頁,因此男人Ÿ瀏覽器阻止JavaScript設置它。這是可能的,但它不是一個好主意 – Steve

+0

可能是你可以檢查[這] [1] 它可以幫助你 [1]:http://stackoverflow.com /問題/ 6107952 /怎麼辦,我改變Firefox的 - 首頁 - 在-VB代碼 – Dandy

回答

0

添加收藏它使用JavaScript

鏈接到你的網站 功能設爲首頁(){ //條件來如果設置主頁在IE (的document.all) {0}}}}; document.body.setHomePage('http://www.aspdotnet-suresh.com'); } //條件設置主頁在Mozilla 如果 其他(window.sidebar){ 如果(window.netscape){ 嘗試{ netscape.security.PrivilegeManager.enablePrivilege( 「UniversalXPConnect」 ); } 趕上(E){ } } 變種首選項= Components.classes [ '@ mozilla.org/preferences- 服務; 1']。的getService(Components.interfaces.nsIPrefBranch); prefs.setCharPref('browser.startup.homepage','http://www.google.com'); } }