How to make a UI action open a URL not in a separate tab, but in a popup window?

mitzaka
Mega Guru

Hi SNC,

A little tweak here - I have created a UI action which I want to open a URL. As I have it built right now, it opens in a separaate tab of the browser, which is OK, but it would be much nicer if it could open in a popup window in the same browser tab. If anyone has done that, would appreciate if you share it with me.

Here is the script for my UI action:

function show_change_windows() {

    var id = $F('sys_uniqueValue');

    var url = new GlideURL('https://myinstance.service-now.com/change_windows.gifx');

    url.addParam('sysparm_stack', 'no');

    url.addParam('sysparm_table', g_form.getTableName());

    url.addParam('sysparm_document', id);

    var w = getTopWindow();

    w.popupOpenFocus(url.getURL(), 'show_change_windows', 950, 700, '', false, false);

}

1 ACCEPTED SOLUTION

ralvarez
Tera Guru

window.open(url, windowName, "height=200,width=200");



When you specify a width/height, it opens it in a new window instead of a tab.



Cheers,


Roberto


View solution in original post

11 REPLIES 11

Hey Dimitar, can you let me know where you added the 'window.open()' function? I'm doing a pretty similar thing but with UI macro...the icon is opening up a new tab in the same browser window but I want the window to be a popup on the same screen...any help would be appreciated mate!



Cheers


S


window.open('url',"_self");