Wednesday, September 16, 2009

How to modify theme so that all URL links open in a new window


You create a new URL link using the Manage Pages portlet in IBM® WebSphere® Portal version 6.0. When a user clicks on this new URL link, it displays the target page in the same window as opposed to opening a new Web browser window. How can you force it to open a new browser window when clicking the URL link?

How do i do
In this scenario, the customer was working on a page copied from the default IBM theme which implements top navigation. In order to have URL links open in a new window, it is necessary to perform the following steps:

1) Edit the topNav.jspf located in /installedApps//wps.ear/wps.war/themes/html/ as follows:


    FirstRow">

    <% boolean openInNewWindow = com.ibm.portal.content.ContentNodeType.EXTERNALURL.equals(wpsNavNode.getContentNode().getContentNodeType()); %>

    <% boolean isNodeSelected = wpsSelectionModel.isNodeSelected(wpsNavNode); %>

  • id="portalSelectedNode" onmouseover="showPageAffordance(); return false;" onmouseout="hidePageAffordance(); return false;" <% } %> >
    "
    <% if (openInNewWindow) {%>target="_blank"<% } %> <% if (isNodeSelected) { %>onfocus="showPageAffordance()" <% } %> >


    . . . . . . .



  • "
    <% if (openInNewWindow) {%>target="_blank"<% } %>>





  • 2) "Touch" the Default.jsp for the theme (located in the same directory) by editing the file (nature of edit does not matter) and then saving the file.
    3) Remove any temp files for the theme in /temp//WebSphere_Portal/wps/wps.war/themes/html/.
    4) Start WebSphere Portal.
    5) Click on the URL link and it should now open a new window.