Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the Home Page in Chrome browser from Extension

Does anyone know how to change the user's Home page in Chrome Browser from Chrome Extension?
I tried some solutions like document.setHomePage but it doesn't work.

In firefox, I am using the following code:

prefs.setCharPref('browser.startup.homepage', searchUrl);

Any suggestions?

Thanks.

like image 923
Em1 Avatar asked Jun 28 '11 13:06

Em1


People also ask

How do I change the homepage shortcut in Chrome?

Just go to the 'Shortcuts' dialog in the Customize menu. Open a new tab. At the bottom right, click Customize. Click Shortcuts.


2 Answers

The closest thing currently available is allowing your extension to override the "new tab" page. include this in your manifest:

{
  "name": "My extension",
  ...

  "chrome_url_overrides" : {
    "newtab": "myPage.html"
  },
  ...
}

However, your users may set their new tab page to any other url as their home page.

like image 58
Udi Avatar answered Dec 06 '22 17:12

Udi


It is now possible to override the homepage through the chrome_settings_overrides option:

{
  "name": "My extension",
  ...
  "chrome_settings_overrides": {
    "homepage": "http://www.homepage.com",
  }
}
like image 27
Jérémie Bertrand Avatar answered Dec 06 '22 17:12

Jérémie Bertrand