function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Chris HeathChris Heath 

apex:tab open in new window?

Hello all,

I'd like to know if there is a way to open an apex:tab element in a new window when the tab header is clicked.

Currently, I have a way to link directly to a specific tab on my Visualforce page using a page parameter. However, I'm having trouble with my implementation.

My desired functionality is as such:
  • When a tab header is clicked, do not go to that page.
  • Instead, a new window will open directly to that tab header.
What I've tried so far:
onclick="window.open('/apex/pagename?tab=tabname','_blank');" disabled="true"
This causes nothing to happen when header is clicked.
 
onclick="window.open('/apex/pagename?tab=tabname','_blank');"
This causes the tab to function in the standard way - opens in the current tab without carrying over the parameters in the URL.
 
ontabEnter="window.open('/apex/pagename?tab=tabname','_blank');"
This causes the tab to open in a new window as desired, carrying over the parameters; however, the original window still loads the new tab instead of staying on the previous tab.


Any help is much appreciated.

Thank you.

 
Andy BoettcherAndy Boettcher
There is some inherent JS running with those tabs, so trying to override them in the control itself won't work - you may be able to override them with some jQuery or something.  Failing that - you may want to use some jQueryUI tabs and run your own UI.