On Chrome, clicking on a link in the default_popup window closes it.
This is not the case in the current Firefox Nightly, so I wanted to do it with a call to window.close() on the onclick event handler but it seems that the popup window doesn’t behave as the other html pages regarding javascript support : alert() works but neither window.close() nor console.log().
There is no error message in the console.
manifest.json:
{
"manifest_version": 2,
"name": "webextensions tests",
"version": "1.0",
"applications": {
"gecko": {
"id": "webextensions@bourcereau.fr"
}
},
"browser_action": {
"default_title": "Tests",
"default_popup": "popup.html"
}
}
popup.html:
<!doctype html>
<html>
<body>
<a href="#" onclick="alert('something')">alert : ok</a><br>
<a href="#" onclick="console.log('something')">console.log : not ok</a><br>
<a href="#" onclick="window.close()">window.close : not ok</a><br>
</body>
</html>
Complete extension source here : https://github.com/mmai/firefox_webextensions_tests