target blank at URL

0

On my site I have a floating button that has an image and allows me to put a URL, however, you do not have the option to open in a new tab. You only have the space for the URL.

I would like to know if you can do the target=_blank direct function in the URL, type www.meusite.com.br/contato=_blank

In this way, even without having the manual option to open in a new tab, I could put target=_blank right in the URL and make it open in a new tab when clicking on this link.

Is there such a thing?

    
asked by anonymous 30.05.2018 / 04:44

1 answer

0

Direct in the url will not take as. The only possible way would be to insert a javascript code into your page. For example, if you add the code below, every time you click on any element of your page document that is anchor a , it will open the link in a new tab.

$(document).on('click', 'a', function(e){ e.preventDefault(); var url = $(this).attr('href'); window.open(url, '_blank'); });

    
30.05.2018 / 05:04