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.

കൂടുതലറിയുക

How do I get Firefox's home page to open a new tab when searching?

  • 4 മറുപടികൾ
  • 5 have this problem
  • 1 കാഴ്ച
  • Last reply by Pluto

I'm slightly modifying Firefox's about:home page, and I'm trying to get the home page to effectively be its own app tab. In order to do that, I need to make it so that when I search with it, it opens a new tab to view my search results.

I've tried two things so far; I've tried adding the attribute target="_blank" to the <form> tag, and I've tried adding the attribute onclick="this.form.target='_blank';return true;" to the <input> tag nested inside of the <form> tag (I'm guessing the latter is JavaScript lol). I also tried an extension "TabSubmit" which didn't work here.

I know how to edit the right page (I'm changing the contents of aboutHome.xhtml in omni.ja), and have already edited the stylesheet slightly (to underline links when hovering over them and adjusting the fading of Mozilla's logo when hovering over it). This is the next change I wanted to make.

Any suggestions? Thanks!

I'm slightly modifying Firefox's about:home page, and I'm trying to get the home page to effectively be its own app tab. In order to do that, I need to make it so that when I search with it, it opens a new tab to view my search results. I've tried two things so far; I've tried adding the attribute '''target="_blank"''' to the '''<form>''' tag, and I've tried adding the attribute '''onclick="this.form.target='_blank';return true;"''' to the '''<input>''' tag nested inside of the '''<form>''' tag (I'm guessing the latter is JavaScript lol). I also tried an extension "TabSubmit" which didn't work here. I know how to edit the right page (I'm changing the contents of aboutHome.xhtml in omni.ja), and have already edited the stylesheet slightly (to underline links when hovering over them and adjusting the fading of Mozilla's logo when hovering over it). This is the next change I wanted to make. Any suggestions? Thanks!

Modified by Pluto

Chosen solution

The about:home uses window.location.href = url; to change the location of the current tab.

Changing this to window.open(url); and adding a line at the end of the aboutHome.js file to initialize localStorage works for me with a locally saved about:home page.

function onSearchSubmit(aEvent)
{
  let searchTerms = document.getElementById("searchText").value;
  if (gSearchEngine && searchTerms.length > 0) {
    const SEARCH_TOKENS = {
      "_searchTerms_": encodeURIComponent(searchTerms)
    }
    let url = gSearchEngine.searchUrl;
    for (let key in SEARCH_TOKENS) {
      url = url.replace(key, SEARCH_TOKENS[key]);
    }
    window.open(url);
  }

  aEvent.preventDefault();
}

localStorage["search-engine"]="{\"name\":\"Google\",\"searchUrl\":\"http://www.google.com/search?q=_searchTerms_&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a\"}";
Read this answer in context 👍 2

എല്ലാ മറുപടികളും (4)

Sorry, tried to do the same thing and had no luck. I gave up because I realized that after every update of Firefox I might have to do the same thing all over again if the omni.jar file was changed with the update.

IMO, it is easier to use the Search Bar on the Navigation Bar because there's a pref to toggle to have an "Enter" key search always open in a new tab, while clicking on the Magnifying glass button will open the search in the active tab.

browser.search.openintab

Well I do often use the URL bar, since I removed the search bar (it makes no sense to have both). But I never use the about:home page, which is why I wanted to do this.

Chosen Solution

The about:home uses window.location.href = url; to change the location of the current tab.

Changing this to window.open(url); and adding a line at the end of the aboutHome.js file to initialize localStorage works for me with a locally saved about:home page.

function onSearchSubmit(aEvent)
{
  let searchTerms = document.getElementById("searchText").value;
  if (gSearchEngine && searchTerms.length > 0) {
    const SEARCH_TOKENS = {
      "_searchTerms_": encodeURIComponent(searchTerms)
    }
    let url = gSearchEngine.searchUrl;
    for (let key in SEARCH_TOKENS) {
      url = url.replace(key, SEARCH_TOKENS[key]);
    }
    window.open(url);
  }

  aEvent.preventDefault();
}

localStorage["search-engine"]="{\"name\":\"Google\",\"searchUrl\":\"http://www.google.com/search?q=_searchTerms_&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a\"}";

It worked thank you! :D

Modified by Pluto