Creating A Popup Window

Standard behaviour in APEX is for a branch to link to a page using the current window (or tab). However there are times when it is desirable for the application to link to another page in a popup window. This may be popup help, like the standard help in APEX, or maybe a print preview page. The following is how to create 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 (URL, windowName[, windowFeatures]);

The name of the popup window. This name is not visible by the user, and is only there for reference by Javascript. For the example below I have decided to use the name popup1. If was called again, using “popup1” as the windowName, then the contents of the popup would be refreshed with this new call. For this reason it is a good idea to use unique names for each window

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 please check out the post on URL parameters

This allows the developer to define specific features for the popup window. For example, no scrollbars, the size of the window and whether certain menu bars are visible. For a full list of features visit here

The Javascript“f?p=&APP_ID.:200:&SESSION.”,”popup1″);

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

A couple of things to note when using popups.

You will see that I have passed in the current session value to the new popup. This is useful as it allows the window to have access to all your current session values, as well as knowing that you have passed authentication. One issue with using the same session is that the two windows could be able to access(or more importantly, alter) the same session values at the same time. This can cause unexpected results.

Therefore it is sensible to have the popup as a deadend in your application. For example this could be a single page containing a print preview of the current page, with no links to any other page. For this reason it is a good idea to use a template specific to popup pages. This template should be as blank as possible and have little or no navigation items in it.

Another issue is the use of popup blockers. In most cases it is not known whether the end user is using a blocker, and how that blocker will behave when the popup is called. Unfortunately there is no easy answer to this and must be addressed on a case by case basis.

4 thoughts on “Creating A Popup Window”


    function printPage() {
    var PrintCommandObject = “”;
    if (navigator.appName == “Microsoft Internet Explorer”)
    PrintCommandObject.ExecWB(6, 2);
    PrintCommandObject.outerHTML = “”;
    else{ alert(“MySap”);
    window.print(); }



    — Konec ———————————————————;

  2. On a related post, I asked a similar question.

    In apex 4.0. Please give step by step instructions on how to place the “javascript behind a button” -> This can be placed behind a button.

    I see no menu to create a dynamic action on a button, nor to I see a property that says “place your javascript here” when I edit a button, nor do I see a way to put javascript into a process or branch.

Leave a Reply

Your email address will not be published. Required fields are marked *