Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Close Chrome extension with button

I am trying to close a chrome extension on-click of a button. The window is the only window open for this app. I thought the below would work but receiving the following console errors.

I am referencing jQuery in my HTML. All I want it to click a button and close my chrome app.

Uncaught TypeError: Cannot read property 'current' of undefined

$(document).ready(function() {
  $("#close").click(function() {
    chrome.app.window.current().close();
  });
});

The duplicate in no way explains my issue

like image 790
Luke Toss Avatar asked Sep 15 '25 11:09

Luke Toss


1 Answers

Try this from the window:

window.close();
like image 54
Shiven Sinha Avatar answered Sep 17 '25 00:09

Shiven Sinha