BGroat
BGroat

Reputation: 149

Open tab with button click using Chrome Tabs API

Does anyone have any advice on how I would open a new tab in google chrome, using the Chrome Tabs API. I've been trying to do this in my Google Chrome extension, like so

<form>
    Which page would you like to visit? <br />
    <input type="text" id="channel" name="channel" placeholder="url">
    <input type="button" value="button name" chrome.tabs.create="('#input from id="channel"')" />
</form>

but this doesn't seem to do the trick. Can anyone see what I'm doing wrong? (ignore the #input from id part, I know that won't work).

Thanks in advance

Upvotes: 0

Views: 429

Answers (1)

D--
D--

Reputation: 86

If you don't HAVE to use chrome extension

<input type="button" onclick="window.open(document.getElementById('channel').value,'_blank')" />

_blank is the argument needed to open on a new tab.

Upvotes: 1

Related Questions