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
Patrick Mayer 4Patrick Mayer 4 

Conditional tab opening in an embedded vf page

This is a function that works in my other vf pages. When I am using it from an embedded vf page however, 
sforce.console.isInConsole() always goes false. Any ideas for a work-around.



 
function openSubtab(id) {
  // Check if user is in the Console, otherwise open as a regular URL
  if (sforce.console.isInConsole()) {
    sforce.console.getEnclosingPrimaryTabId(function(result) {
        sforce.console.openSubtab(result.id, '/' + id, true, '', null);
    });
  } else {
    window.open('/' + id);
  }
};