help with checkbox/variable/newtab


Recommended Posts

Probably not going to get a reply... but will give it a go and see what happens.

I'm having trouble getting the "activate" parameter of the newtab function to work when the string is called from a variable.


 mxTabs.newTab({url:"url", activate:true, position:"afterCurrrent"});

when activate is set to true or false directly in that line it works fine. If I have a variable "openTab" set to true or false and called in that same line "activate:openTab" it also works.

But if I have a variable "openTab" with a value set to true or false which is determined from some javascript, and then saved and called via the api, it never seems to work and always defaults to "true".

Doing an alert (openTab) or"openTab") shows that the string is correct.

Getting quite annoying, as I know what I want to do and i'm pretty sure i've got it all right, but this just won't work.

Link to comment
Share on other sites

In javascript environment, If your variable is not a boolean, every value of variable represents true except "0" string, undefined or null value. You must compare storage value to what you need.

var mxRuntime = window.external.mxGetRuntime(),
    mxStorage =,
    mxTabs = mxRuntime.create('mx.browser.tabs');

var activate = mxStorage.getConfig('openTab') == 'true';
  url: url,
  activate: activate,


  • Like 1
Link to comment
Share on other sites