This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Open external link in new window
#1
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
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
Reply
#2
Only via custom JS:
Code:
$('.my-custom-cls').off('vclick').on('vclick', function() {
  window.open('http://...');
})
Reply
#3
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>
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
Reply
#4
Have you placed it into jQuery document ready wrapper like this?
Code:
$(function(){
  // your code here
});
Reply
#5
Thank you, that was the problem.
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
Reply
#6
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
Reply
#7
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/');
        })
});
Reply


Forum Jump: