Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show alert from Chrome Extension "options_ui" page

Chrome Extensions have had a Version 2 of their options page since Chrome 40. I tried creating an options V2 page with a button that just has a simple alert:

js

function resetAll() {
  alert("Not yet implemented.");
}

document.getElementById("reset-button").onclick = resetAll;

html

<button id="reset-button">Reset All</button>

When I click the button in the options page, nothing happens. I even pulled up the Javascript Debugger to see if my code was actually being run. And it was, but no alert showed up.

If I use Chrome Extension's older options page format, the alert shows up without problem.

Is there no way to create a browser-native alert with OptionsV2?

like image 855
geoff Avatar asked May 19 '16 23:05

geoff


People also ask

How do I turn on alert box in Chrome?

Select Content Settings under Privacy.A box with a list of settings will appear. Enable or Disable JavaScript is the last option. Select "Enable".

Can a website detect Chrome extension?

The website detects that my extension is installed and updates the page accordingly. Is this possible? Yes, it is possible to detect extensions, so long as you know your extension ID (which I'm sure you do).

How do I monitor my browser extensions?

Or, in the menu bar, go to Window > Extensions. Or, right-click on any extension icon in your toolbar and choose Manage Extensions. The Extension page shows a list of all extensions you've installed for Chrome and whether they are enabled or disabled.


1 Answers

chrome.extension.getBackgroundPage().alert('Are you sure you want to delete X?');
chrome.extension.getBackgroundPage().confirm('Are you sure you want to delete X?')
like image 61
BART96 Avatar answered Oct 25 '22 04:10

BART96