Where did you install Firefox from? Help Mozilla uncover 3rd party websites that offer problematic Firefox installation by taking part in our campaign. There will be swag, and you'll be featured in our blog if you manage to report at least 10 valid reports!

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

When using "chrome_url_overrides" in the manifest.json of my addon to change the new tab page, is it possible to focus on an element in the page?

  • 1 பதிலளி
  • 1 இந்த பிரச்சனை உள்ளது
  • 5 views
  • Last reply by user1321319

My manifest is this:

   {
   	"manifest_version": 2,
   	"name": "Simple Startpage",
   	"version": "1.0",
   
   	"description": "My very simple start page",
   
   	"chrome_url_overrides": {
   		"newtab": "index.html"
   	}
   }

`index.html` is a normal HTML page that references an `index.js` which contains code something like this:

   window.onload = () => {document.getElementById("search").focus()}

However, when I open a new page, it focuses the address bar at the top instead of my element. Is there an approach I could take to this that would let me focus that element? Directly opening the file verifies that the focus() works.

My manifest is this: { "manifest_version": 2, "name": "Simple Startpage", "version": "1.0", "description": "My very simple start page", "chrome_url_overrides": { "newtab": "index.html" } } `index.html` is a normal HTML page that references an `index.js` which contains code something like this: window.onload = () => {document.getElementById("search").focus()} However, when I open a new page, it focuses the address bar at the top instead of my element. Is there an approach I could take to this that would let me focus that element? Directly opening the file verifies that the focus() works.

All Replies (1)

Please visit this page for help with development questions.