Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Learn More

How do I set my local HTML page as a homepage?

  • 13 trả lời
  • 1 gặp vấn đề này
  • 1532 lượt xem
  • Trả lời mới nhất được viết bởi ondrej256

more options

Hi,

I like having my local HTML file as a homepage which gives me links to my favourite sites. However, Firefox doesn't seem to support loading a local homepage in a new tab. I have attempted to resolve this by setting up a server and using the My Homepage addon which kind of workds, but it's extremely slow and cumbersome.

Would be very grateful if someone had a better idea.

Hi, I like having my local HTML file as a homepage which gives me links to my favourite sites. However, Firefox doesn't seem to support loading a local homepage in a new tab. I have attempted to resolve this by setting up a server and using the My Homepage addon which kind of workds, but it's extremely slow and cumbersome. Would be very grateful if someone had a better idea.

Giải pháp được chọn

OK, I see what is wrong.

You need to add a third line to the autoconfig.js file.

//
pref("general.config.filename", "autoconfig.cfg");
pref("general.config.obscure_value", 0);
pref("general.config.sandbox_enabled", false);
Đọc câu trả lời này trong ngữ cảnh 👍 1

Tất cả các câu trả lời (13)

more options

Go to your settings and in there you can make whatever url your homepage.

more options

Unfortunately, this exactly does not work with a local file. I want my homepage to be shown every time I open a new tab, but that doesn't work with a local address (file://address), only with a remote one (http://address).

more options

You can use an autoconfig.cfg file to set the new tab page. This also works with a local page for me.


// first line is a comment
var {classes:Cc,interfaces:Ci,utils:Cu} = Components;
var newTabURL = "about:blank";
aboutNewTabService = Cc["@mozilla.org/browser/aboutnewtab-service;1"].getService(Ci.nsIAboutNewTabService);
aboutNewTabService.newTabURL = newTabURL;

You can use the autoconfig.cfg file in the Firefox program folder to initialize (set/lock) preferences.

The autoconfig.cfg file needs to be in the main Firefox program folder.

This requires a autoconfig.js file in the "defaults/pref" folder where the channel-prefs.js file is located that specifies to use autoconfig.cfg.

//
pref("general.config.filename", "autoconfig.cfg");
pref("general.config.obscure_value", 0);
pref("general.config.sandbox_enabled", false);

The autoconfig.cfg and autoconfig.js files need to start with a comment line (//).

See also:

(edited to add the sandbox pref to autoconfig.js)

Được chỉnh sửa bởi cor-el vào

more options

Thanks for your reply, however, it doesn't seem to have worked. I added the two files into the relevant folders (/usr/lib/firefox/autoconfig.cfg and /usr/lib/firefox/defaults/pref/autoconfig.js, but sadly nothing has changed after restarting Firefox.

more options

Sorry, I noticed that I made an error in the autoconfig.cfg file while pasting my own code.

Components["@mozilla.org/browser/aboutnewtab-service;1"] should be Components.classes["@mozilla.org/browser/aboutnewtab-service;1"]

I corrected the above posted code and tested it this time.

more options

Thanks cor-el, but sadly this hasn't worked either. I get a blank page every time I open a new tab and have to manually click on the home button to get me to the homepage. I am still using the My Homepage addon, but there must be something which prevents it from accessing my local homepage.

I have also tried disabling the My Homepage addon, but that doesn't work at all as I end up on Firefox Home (the page with links to sites I recently visited).

more options

Did you replace the about:blank value with the URL of your desired new tab page?

  • var newTabURL = "file:///...";
more options

Yes, I did. It still doesn't change anything. I uploaded two screenshots to show you the current settings with the two created files and one to show what happens when I open a new tab.

more options

You will have to disable the My Homepage extension that is controlling the new tab page as you can see in the third screenshot.

more options

Are you sure that /usr/lib/firefox is the correct directory because Firefox would normally display a message at the top of the about:preferences page that an autoconfig file is active?

Được chỉnh sửa bởi cor-el vào

more options

When I disable the addon a new tab shows the Firefox Home (the page with links to sites I recently visited).

I am not sure if it is in the right directory, however, I can show you a screenshot of my web console if it makes any sense to you.

more options

Giải pháp được chọn

OK, I see what is wrong.

You need to add a third line to the autoconfig.js file.

//
pref("general.config.filename", "autoconfig.cfg");
pref("general.config.obscure_value", 0);
pref("general.config.sandbox_enabled", false);
more options

Thank you, cor-el! That works great! You've made my day, I am ever so obliged! I'll think of you every time I open a new tab. ;-)