7twenty Posted February 22, 2017 Report Share Posted February 22, 2017 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. In: 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 mx.storage api, it never seems to work and always defaults to "true". Doing an alert (openTab) or rt.storage.getConfig("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 More sharing options...
bayas Posted February 24, 2017 Report Share Posted February 24, 2017 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 = mxRuntime.storage, mxTabs = mxRuntime.create('mx.browser.tabs'); var activate = mxStorage.getConfig('openTab') == 'true'; mxTabs.newTab({ url: url, activate: activate, position:"afterCurrrent" }); 1 Link to comment Share on other sites More sharing options...
Recommended Posts