Don Rhummy
Don Rhummy

Reputation: 25870

How do I restrict my chrome app from being opened multiple times (so just one instance)?

I have a Chrome app that I need to be just one instance. If they click the app icon again, it should go to the already opened instance instead of opening another instance. How would I do this?

Upvotes: 11

Views: 4901

Answers (1)

Vincent Scheib
Vincent Scheib

Reputation: 18620

Create the window with an id and as a singleton. See the chrome.app.window documentation.

E.G. modify the hello world sample to create the window with

  chrome.app.window.create('index.html', {
    id: "", // Even an empty string is sufficient.
    singleton: true,

Upvotes: 13

Related Questions