1

I am trying to build an add-on that will, at one point, open a link. However, my issue is that I can't find a method I can use to open a link in the same tab and in the same browser window.

I was looking at this link:

Open URL in same window and in same tab

but when I tried what was suggested my add-on carried on opening the url in a new window and tab. I've been unable to find any documentation on this as well. Could someone point me in the right direction?

If it helps at all this is my code:

var buttons = require('sdk/ui/button/action');
var windows = require("sdk/windows").browserWindows;

var button = buttons.ActionButton({
    id: "access-link",
    label: "Access eHOPortal",
    icon: {
        "16": "./panorama-16.png",
        "32": "./panorama-32.png",
        "64": "./panorama-64.png"
    },
    onClick: handleClick
});

function handleClick(state) {
    windows.open("myURL", "_self");
}
Community
  • 1
  • 1
Wajih
  • 229
  • 1
  • 2
  • 12

1 Answers1

2

It seems easier than you think, for example:

require('sdk/tabs').activeTab.url = 'http://www.stackoverflow.com';

causes the page to start loading instantly in active tab.

Sagi
  • 578
  • 1
  • 4
  • 13