Skip to main content
Announcements
Qlik Community Office Hours, March 20th. Former Talend Community users, ask your questions live. SIGN UP
cancel
Showing results for 
Search instead for 
Did you mean: 
cbaqir
Specialist II
Specialist II

Link open in new tab vs new window?

I have an expression as a link that I want to open as a new tab within the SAME window as opposed to opening a new browser window. Is that possible?

Here is my expression:

='ALM ' &'<url>linkurlhere=' & DEFECT_ID & ''

2 Replies
Gysbert_Wassenaar

Only if your browser has a setting to force new links to open in a new tab. Qlikview can't force this behavior for opening links.


talk is cheap, supply exceeds demand
yakir_manor
Contributor III
Contributor III

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.

for example i don't think you want the 'window.open' and 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>