Search code examples
alfrescoalfresco-sharealfresco-webscripts

open "view details" page in new tab at alfresco workflow form


open "view details" page in new tab at alfresco workflow accept/reject page but ** also to retain focus on the current page (approval/rejection) page** with target=_blank focus on current page is getting lost ****overriding object-finder.js here****

 function ObjectFinder_fnRenderCellListItemName(elCell, oRecord, oColumn, oData)
             {
              if (scope.options.showLinkToTarget && scope.options.targetLinkTemplate !== null)
                {
                 if(item.site=="######xxxxxxxxxxany site****"){
                       title = '<a href="' + link + **'"target="_blank">**' + $html(item.displayName?item.displayName:item.name) + '</a>';


                    }
                }

    ObjectFinder_fnRenderCellListItemActions(elCell, oRecord, oColumn, oData)
         {
          if (scope.options.disabled === false) 
            {
               var links = "", link, listAction;
               for (var i = 0, il = scope.options.listItemActions.length; i < il; i++)
               {
                  listAction = scope.options.listItemActions[i];
                  if (listAction.event)
                      {

                      if(item.site=="xx Any RAndom Site xxxxx"){

                      links += '<div class="list-action"><a href="#" class="' + listAction.name + ' ' + ' list-action-event-' + scope.eventGroup + ' ' + listAction.event+ '" title="' + scope.msg(listAction.label) + '" tabindex="0" **target="**_blank**">'** + scope.msg(listAction.label) + '</a></div>';

                  }

Solution

  • Staying in the current tab when opening a new tab is controlled by the browser and there are some workarounds are present here.

    You may need to simulate "Ctrl" + Click event while clicking the link.Please refer the below links.

    https://stackoverflow.com/a/36027776/405317

    Open a new tab in the background?

    https://www.quora.com/How-do-I-open-a-link-in-a-new-tab-but-stay-on-the-same-page-using-HTML-code

    https://productforums.google.com/forum/#!topic/chrome/RCCFMX3b7NA

    Hope you will get some idea.