We are creating a GUI Extension which should open a popup. Based on some examples, we have placed the following code in Extensions.Tr.prototype._execute:

var popup = $popup.create(url, 

where url is the url of the application. Our problem is that when someone clicks more than once on the icon of the GUI extension, the popup is opened more than once. We would like to avoid that.

So if a popup is already open, we wish to just the change its url, and not open a new popup.

How this can be achieved through passing some parameters (popup name, etc)?

Is there a way to do it with this kind of code?

var popup= window.open(url,

where the second parameter is the name of the popup window, and the last parameter is set to true (true - URL replaces the current document in the history list).

I would like to make as much use as possible of standard Tridion code for this, and avoid writing too much custom code.

1 Answer 1


there is no built-in functionality like that, but you can easily achieve this in the following way.

$popup.create(...) will return you reference to Popup object, which can be stored somewhere in the Command properties: `this.properties.popupInstance = $popup.create(...);

So next time when Command is executed, you can check for presence of Popup instance. Besides that you'll need to track situation when popup is closed. To do that you'll need to add event handler to Popup instance for "close" event (it also might be "cancel"). Resulting code might lood like this:

var onPopupClose = function() {
    $evt.removeEventHandler(this.properties.popupInstance, "close", this.getDelegate(onPopupClose));
    this.properties.popupInstance = null;

var popup = this.properties.popupInstance; 
    popup = $popup.create(...);

    $evt.addEventHandler(popup, "close", this.getDelegate(onPopupClose));


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.