Zeynel
Zeynel

Reputation: 13525

How to create a new tab with default values?

In new tab create method I see that all Parameters for createProperties(object) are marked "optional". But when I try

//if there is no storage create a new tab

var firstRun = (localStorage['firstRun'] == 'true') ;

if (!firstRun)
{
    chrome.tabs.create() 
    {
        console.log("new tab is created")   
    }
}

I get Uncaught Error: Parameter 1 is required.. This answer to a similar question also appears to say that parameters are optional.

What am I missing? Thanks.

Upvotes: 1

Views: 150

Answers (1)

Digital Plane
Digital Plane

Reputation: 38284

Just pass an empty object:

chrome.tabs.create({});

The object is not optional, the values in it are.

Upvotes: 1

Related Questions