Creating a javascript popup window in APEX

Standard behaviour in APEX is for a branch to link to a page using the current window (or tab). There are times when you want the application to link to another page in a popup window.

To create the popup window I am going to use Javascript. This can be placed behind a button or text link, or it can be placed in an HTML region.

The code to create the popup is very simple

window.open (URL, windowName[, windowFeatures]);

windowName
This name is not visible by the user, and is only there for reference by us in our code. For the example below I have decided to use the name popup1. If window.open was called again, using “popup1” as the windowName, then the contents of the popup would be refreshed with this new call. That might be what you want, but I tend to prefer to use unique names.

URL
In the example code below I will simply call page 200 without passing in any page item values. If you wish to pass in values, or pass in a request value then read about URL parameters.

windowFeatures
This allows the developer to define specific features for the popup window. Eg no scrollbars, the size of the window, whether menu bars are visible.

The Javascript

window.open("f?p=&APP_ID.:200:&SESSION.","popup1");

The above code will open a new window (or tab depending on your specific browser settings) called popup1, containing page 200. Easy.

One thought on “Creating a javascript popup window in APEX”

  1. How/where do you input the javascript within the APEX cms? Tried applying it to the button, but it didn’t work.

Leave a Reply