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".

Tìm hiểu thêm

Customize New Tab with a local HTML file after Firefox 136

  • 3 trả lời
  • 0 gặp vấn đề này
  • 26 lượt xem
  • Trả lời mới nhất được viết bởi LluisE

more options

Hello,

I wanted to customize my Firefox new tab with a local HTML file, such as "/path/to/my/index.html". It was possible to use this workaround: https://github.com/Jangsoodlor/Firefox-New-Tab-Config/tree/main https://github.com/Jangsoodlor/Firefox-New-Tab-Config/tree/main

Which implied a configuration file (sometimes named "autoconfig.cfg", "firefox.cfg", "local-settings.cfg" depending on the guide since the name is arbitrary) with javascript code. In the new Firefox 136, this code fails to execute due to a new API being used.

If you want to customize your new tab, follow the previous guide, but on the configuration file write this code instead:

// My new tab
try {
  const ff = {};
  ChromeUtils.defineESModuleGetters(ff, {AboutNewTab: "resource:///modules/AboutNewTab.sys.mjs"});
  ff.AboutNewTab.newTabURL = 'file:///path/to/my/index.html';
} catch (e) {ChromeUtils.reportError(e);}

Note that the file must start with a comment

Adapting the "/path/to/my/index.html" to your needs.

Thanks to @mkaply (github) on this thread https://github.com/mozilla/policy-templates/discussions/1190 for the new API method.

I post this here in case someone has the same issue, because is quite recent and hard to find on the internet.

Hello, I wanted to customize my Firefox new tab with a local HTML file, such as "/path/to/my/index.html". It was possible to use this workaround: [https://github.com/Jangsoodlor/Firefox-New-Tab-Config/tree/main https://github.com/Jangsoodlor/Firefox-New-Tab-Config/tree/main] https://github.com/Jangsoodlor/Firefox-New-Tab-Config/tree/main Which implied a configuration file (sometimes named "autoconfig.cfg", "firefox.cfg", "local-settings.cfg" depending on the guide since the name is arbitrary) with javascript code. In the new Firefox 136, this code fails to execute due to a new API being used. If you want to customize your new tab, follow the previous guide, but on the configuration file write this code instead: <pre> // My new tab try { const ff = {}; ChromeUtils.defineESModuleGetters(ff, {AboutNewTab: "resource:///modules/AboutNewTab.sys.mjs"}); ff.AboutNewTab.newTabURL = 'file:///path/to/my/index.html'; } catch (e) {ChromeUtils.reportError(e);} </pre> ''Note that the file must start with a comment'' Adapting the "/path/to/my/index.html" to your needs. Thanks to @mkaply (github) on this thread [https://github.com/mozilla/policy-templates/discussions/1190 https://github.com/mozilla/policy-templates/discussions/1190] for the new API method. I post this here in case someone has the same issue, because is quite recent and hard to find on the internet.

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

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

An internal file name changed, so you need to update that in your startup script.

AboutNewTab.jsm => AboutNewTab.sys.mjs

See: https://support.mozilla.org/questions/1497230


Oh wait, you are trying to post a solution, but your code is a mess. Please use <pre> before and </pre> after your code block so the syntax isn't mistaken for markup.

Đọc câu trả lời này trong ngữ cảnh 👍 1

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

more options

You should post that to github where your getting customization from and ask of the users there whom would know more on the changes and how it works as well. And being recent that would be the most likely place to post as that is where the creators would be to see and check how it works.

Hữu ích?

more options

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

An internal file name changed, so you need to update that in your startup script.

AboutNewTab.jsm => AboutNewTab.sys.mjs

See: https://support.mozilla.org/questions/1497230


Oh wait, you are trying to post a solution, but your code is a mess. Please use <pre> before and </pre> after your code block so the syntax isn't mistaken for markup.

Hữu ích?

more options

Thank you so much jscher2000!

I wish I had seen the support question you linked before, it would have saved me all the trouble.

Also, I have added the < pre > tags as you suggested ^.^

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

Hữu ích?

Đặt một câu hỏi

Bạn phải đăng nhập vào tài khoản của bạn để trả lời bài viết. Vui lòng bắt đầu một câu hỏi mới, nếu bạn chưa có tài khoản.