Logic Machine Forum
Open external link in new window - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: Open external link in new window (/showthread.php?tid=681)



Open external link in new window - Thomas - 17.03.2017

Hi
Can I set link target property somehow? I would like to open a link in new tab or new window. Is it possible?


Thank you


RE: Open external link in new window - admin - 17.03.2017

Only via custom JS:
Code:
$('.my-custom-cls').off('vclick').on('vclick', function() {
  window.open('http://...');
})



RE: Open external link in new window - Thomas - 17.03.2017

I'm not sure if I understand what should I do.
I added

Code:
//external link opened in a new window
$('.kmb-1-external').off('vclick').on('vclick', function() {
 window.open('http://172.20.0.149');
})

into javascript

I added
kmb-1-external
into link's class

But the link is still opened in the same window.

The source of the control is
Code:
<div class="item item-control kmb-1-external" style="left: 907px; top: 196px; z-index: 60;">
  <div class="icon"><img style="width: 46px; height: 46px;" src="/scada/resources/icons/ecl_xL_O_odskok.svg?1489411752">
  </div>
</div>



RE: Open external link in new window - admin - 17.03.2017

Have you placed it into jQuery document ready wrapper like this?
Code:
$(function(){
  // your code here
});



RE: Open external link in new window - Thomas - 17.03.2017

Thank you, that was the problem.


RE: Open external link in new window - PassivPluss - 09.10.2017

Hi
I am using the example over to open a couple of pages in a new window but I would like to open trends in a new window also and I am wondering if there is a way to open the inputtext from the objects link into a new window so I dont have to make a unique custom JS for every link?
Just a custom JS to say that the text in the link should be opened in a new windowSmile


RE: Open external link in new window - Carlos Padilla - 05.05.2020

I will leave you this JS code which will help you if you want to open a new tab both on a computer and on a mobile device, since the above code was only allowing me to open a new tab but only on computers. I hope it works for you.

Code:
$(function(){
    $('.pestaña_publimetro').on('click', function() {
      window.open('https://www.publimetro.co/co/');
        })
});