Categories

CustomNewTabpage.crx

This is an extension for google chrome (4.0+) that will allow you to put in any url that you want to be the newtab page.  To set a custom new tab page, open the options page for this extension and you will go to the page where you can change the newtab URL. Install the extension by clicking on the attachment at the bottom of the post, or this link:  CustomNewTabPage. If you want to revert to the default newtab page, with the thumbnails, then uninstall the extension.

The code for this extension is rather simple:

option.html

<script type="text/javascript">// <![CDATA[
    function update_homepage() {
        var homepage = document.getElementById("homepage").value;
        var re = /^(https?|file|ftp):\/\//;
        var m = re.exec(homepage);
        if (!m) {
            homepage = "http://" + homepage;
        }
        localStorage.homepage = homepage;
        console.log("Set home page to " + homepage);
        var o = document.getElementById("output")
        o.innerHTML = "Set home page to " + homepage;
        o.style = "";
        return false;
    }
    function init() {
        if (localStorage.homepage) {
            document.getElementById("homepage").value = localStorage.homepage
        }
    }
// ]]></script>
<h1>Enter what you want to be the newtab page</h1>
<input id="homepage" type="text" /><button onclick="update_homepage();">Update</button>

redirect.html

<script type="text/javascript">// <![CDATA[
    var homepage;
    if (localStorage.homepage) {
        homepage = localStorage.homepage;
    } else {
        homepage = "chrome-extension://cpknocklipbllidbjjngmcnmadhhpbgo/option.html"
    }
    document.write("<meta http-equiv='refresh' content='0;URL=" + homepage + "'")
// ]]></script>

manifest.json

{
"name": "CustomHomepage",
"version": "1.0",
"description": "Enables setting a custom home page",
"chrome_url_overrides": {
"newtab": "redirect.html"
}
}

Install with this link:CustomNewTabPage

Share

17 comments to CustomNewTabpage.crx

  • Rogier

    I just installed your extension and it works perfect! Great! Thank you very much!

  • it was nothing, Rogier. Under an hour to sort it all out. I spent more time trying to get the attachment on my blog, heh.

  • steve

    This is cool and works well, thanks. But is there a way to make it not automatically put the http:// in the address? I use a local file for my homepage.

  • Should be simple, steve, i’ll look at it today if i can. your url starts with ‘file:///’?

  • Well, i made this change and updated the post. I think that this will not work the way you want it to though, Steve. This extension is using a http redirect to load the page that you specify in the url option, and http redirect is not allowed to point to your file system (for security).

    If you want a local file to be the new tab page, then you’ll need to bundle up your own extension. It’s easy. take my file manifest.json above and copy it to a new folder. replace the string “redirect.html” in your copy of manifest.json to be the file name of the local file you want to use as the newtab page. Copy that file into the new folder you just created, so that it is in the same folder as manifest.json.

    Then go to the chrome extension manage page, click on the + sign that says developer mode, then click on the button that says Load Extension. Browser to your new folder that has the two files, select it and you are done. The newtab page should now show your local file.

  • Matt

    Works great, thanks!

  • Gal

    OMG I’ve been searching for so long for this.
    Thanks man it’s working perfect!

  • TwoPies

    You’ve single handedly saved chrome from deletion.. Thanks

  • Works great – thanks V much!

  • Sharon

    A bit late on the uptake but just installed this and it works perfectly. Thanks very much

  • Thanks for this. Works a treat with SiteLauncher for chrome, whose shortcut doesn’t work with default new tab page.

  • Xiombarg

    Wonderful! Just what the Doctor Ordered!
    Someone needs to make this kind of option Standard in Chrome ;)

  • Steven

    This is AWESOME – THANK YOU!!!

  • noncsi

    i love you, thanks works great.

  • Gary

    You little ripper! Now I just get the google home page everytime I open a new tab. Thankyou. Now why didn’t google just let this happen, why didn’t they ask us what we wanted?
    Thank goodness for smart people like you David!
    Gary

  • Mark

    Thank you very much works great. Do you have an extension for increasing the bookmark toolbar?

  • Mark, if you mean to increase the font size or the size of the images of the bookmark toolbar, I don’t believe this can be done with the Chrome extension API. I haven’t looked at the API much in the last year or so, so I’ll check to see if something has been added that allows for this, but I am not optimistic that this can be done.

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>