cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Open and close tab from thingworx?

gvejandla
1-Newbie

Open and close tab from thingworx?

Is there a way to open a new tab in the browser with URL(ex: "www.google.com") and close the same tab?

What I am trying to achieve is, with the click of button 1, a new tab should open with URL "www.google.com" and

with click of button 2, it should close the same tab. I know using "link widget" I can open the tab, but is there a way to close it?

Thanks.

6 REPLIES 6

You can't control other tabs from within one tab, this is a Browser limitation not a TW limitation ( security issues ).

You can do it using java script:

var tab;

function winOpen(){

  tab= window.open("www.google.com");

}

function winClose(){

  tab.close();

}

Wops, I was wrong

If you want to use this Javascript, I think you will need to create a custom UI Extension in order to store the global variable tab to call it later on for close.

Do you have any link to documentation on how to create custom UI extension?

Thank you.

You can find the information in the Extension Developers Guide.  The link to Download the Guide is in the ThingWorx marketplace on the Eclipse Plugin download page here:  http://marketplace.thingworx.com/Items/eclipse-plugin-for-thingworx-extensions

The section within the documentation you are looking for is called 'Adding Custom Widgets' and it will talk about including custom JS in an Extension.  I highly recommend using the Eclipse Plugin for generating the project and necessary widget files and well as packaging of the Extension.

Good Luck!

Hi Gautham ,

This will be helpful to start

ThingWorx Extensibility

Top Tags