Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"manifest_version": 2,
"name": "New tab URL",
"version": "1.0.1",
"version": "1.0.2",
"description": "Redirect new tabs to a given URL.",
"options_page": "options.html",
"chrome_url_overrides": { "newtab": "redirect.html" },
"permissions": [ "storage" ]
"permissions": [ "storage", "tabs" ]
}
6 changes: 5 additions & 1 deletion redirect.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@ documentReady = (func) ->
if document.readyState == "loading" then window.addEventListener "DOMContentLoaded", func else func()

chrome.storage.sync.get "url", (items) ->
documentReady -> document.location.href = items.url ? defaultURL
url = items.url ? defaultURL
if url
documentReady ->
chrome.tabs.getSelected null, (tab) ->
chrome.tabs.update tab.id, { url }