1 Reply Latest reply: Jan 15, 2017 9:23 AM by Yakir Manor RSS

    Open a link to new browser window in Straight table

    Teppo Ojala

      Hi,

       

      We have created a straight table where one expression is a http-link (Representation = Link) to another solution. This is working nicely, but we would like to open this link to new browser window also with end users, who uses web client. In straight table we don't have a setting "open in same window" like we have in Action button. We have used a syntax

       

       

      ='To Image Viewer ' & '<url>' & http://xyz...

       

      where http://xyz... is our link.

       

      We have QV 11 SR1.

        • Re: Open a link to new browser window in Straight table
          Yakir Manor

          this issue has 2 simple solutions (this solution also supports sub domain):

          1. intervene in the opendoc.htm

          the file location is:

          C:\Program Files\QlikView\Server\QlikViewClients\QlikViewAjax

           

          you can put a listener on the dom

          $(document).bind('DOMSubtreeModified', function () {
            $("a[target='_blank']").each(function(i, element){resetBlankLinks(element);});
          });
          
          function resetBlankLinks(element){
            element.setAttribute('onclick','eval("'+element.href+'")');
            element.target="_self";
          }
          
          function somefunction(relativePath) {
            window.open(document.referrer.match(/h(.[^/]+)/)[0] + "//" + document.referrer.match(/:\/\/(.[^/]+)/)[1] + relativePath);
          }
          
          
          
          
          
          
          
          

           

          now your qlikview table link will be

          '☍<url>javascript:void(somefunction("/SomeRelativePath/?SomeParam='&[SomeId]&'"))'
          
          
          
          
          

           

          this is a solution that lets you go to a function you decide and do whatever you want, but i also slows down the dom a bit.

           

          2. this solution i like better, you can go to relevant qlikview scripts and change them (if your using the web client):

          go to

          C:\Program Files\QlikView\Server\QlikViewClients\QlikViewAjax

          now you need to search in files for

          v.target="_blank"

          i found:

          1. C:\Program Files\QlikView\Server\QlikViewClients\QlikViewAjax\htc\QvAjax.js
          2. C:\Program Files\QlikView\Server\QlikViewClients\QlikViewAjax\mobile\js\smalldevices.js
          3. the Qv.exe you cant change and this is not used in the web client

           

          in each file you will find few locations (should be 2), i'v changed them
          from:

          v.target="_blank";
          
          
          
          

          to:

          v.target="_self";v.onclick=eval(m.url);
          
          
          
          

           

          and my BI url is now:

          '☍<url>javascript:void(window.open(document.referrer.match(/h(.[^/]+)/)[0] + "//" + document.referrer.match(/:\/\/(.[^/]+)/)[1] + "/SomeRelativePath/?SomeParam='&[SomeId]&'"));'
          
          
          
          

           

          see if this helps you, maybe you will want different stuff but this is how you can do it.

          you might want to use different target, see:
          HTML a target Attribute

           

          in any case you can open chrome developer tools (F12) to see the code that is created:

          <a href='javascript:void(window.open(document.referrer.match(/h(.[^/]+)/)[0]%20+%20&quot;//&quot;%20+%20document.referrer.match(/:\/\/(.[^/]+)/)[1]%20+%20&quot;/SomeRelativePath/?SomeParam=SomeId&quot;));'
          target="_self"
          onclick="eval(&quot;javascript:void(window.open(document.referrer.match(/h(.[^/]+)/)[0] + &quot;//&quot; + document.referrer.match(/:\/\/(.[^/]+)/)[1] + &quot;/SomeRelativePath/?SomeParam=SomeId&quot;));&quot;)"
          unselectable="on" style="position: absolute;">
            <div title="☍"
            style="background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); text-align: right; font-style: normal; font-weight: normal; text-decoration: underline; cursor: pointer; position: absolute; overflow: hidden; left: 0px; top: 128px; width: 20px; height: 16px;">
            <div unselectable="on" style="position: absolute; left: 0px; top: 0px; width: 20px; height: 16px;"></div>
            <div class="injected" style="padding: 0px 2px; width: 16px; height: 16px; display: table-cell; vertical-align: middle;">
             <div unselectable="on" title="☍"
             style="width: 16px; cursor: default; white-space: pre; overflow: hidden; word-wrap: normal;">
            <a href='javascript:void(window.open(document.referrer.match(/h(.[^/]+)/)[0]%20+%20&quot;//&quot;%20+%20document.referrer.match(/:\/\/(.[^/]+)/)[1]%20+%20&quot;/SomeRelativePath/?SomeParam=SomeId&quot;));'
            target="_self"
            onclick="eval(&quot;javascript:void(window.open(document.referrer.match(/h(.[^/]+)/)[0] + &quot;//&quot; + document.referrer.match(/:\/\/(.[^/]+)/)[1] + &quot;/SomeRelativePath/?SomeParam=SomeId&quot;));&quot;)">
            ☍</a>
             </div>
            </div>
            </div>
          </a>