Question

Opening tab with

require("sdk/tabs").open({
  url:require("sdk/self").data.url("demo.html")
});

demo.html contains this element:

<a target="_blank" href="https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/tabs">click me</a>

The target attribute is not honored, the page opens in the same tab and of course is subjected to all attach events on the tab.

Was it helpful?

Solution

I would comment but don't have enough reputation.

I just set up fresh firefox addon repo using cfx init to test this out, and in my case, it did open the link in a new tab.

Here is the code.

main.js

require("sdk/tabs").open({
  url:require("sdk/self").data.url("demo.html")
});

and demo.html:

<html>
<head>
</head>
<body>
<p>Hello!</p>
<a target="_blank" href="https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/tabs">click me</a>
</body>
</html>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top