2022
Views
7
Comments
Solved
Trying to open URL in new tab - target _blank not working
Question

I am trying to open an external URL in a new browser tab.


The Service Studio version is 11.6.26 Build 9940


I believe it is coded properly, but it still displays the screen in the current tab.


I have tried the target="_blank" extended property and adding it to the Javascript Open URL.


Please let me know how to do this.   Thank you for your advice.


This is what is generated using the Button and the Link widgets :


#1 using a button widget:


<input target="_blank"

       onclick="window.location.href='https://some-URL','_blank'; return false;"

       type="submit"

       name="wt10$wt37"

       value="view order"

       id="wt10_wt37"

       tabindex="0"

       class="Button btn-small

       ThemeGrid_MarginGutter">



( I also notice this didn't end with />  )    



#2 using a link widget:


<a id="wt10_wt92"

   tabindex="0"

   target="_blank"

   onclick="OsAjax(arguments[0] || window.event,'wt10_wt92','wt10$wt92','','__OSVSTATE,',''); return false;"

   href="#">

   <span id="wt10_wtdisplayOrderNumber"

         class="btn btn-small background-blue" style="font-weight: bold;">

         {the-order-number}

   </span>

</a>


2020-01-10 18-28-17
Chris Kraack
Solution

I tried the Navigate and numerous variations. 

It does work this way: 

onclick="window.open('https://www.w3schools.com/tags/att_button_type.asp', '_blank');"

UserImage.jpg
Gonçalo Oliveira

Hello Chris,


In the button don't put "_blank" in the URL. Regarding the link, the Method is Ajax Submit and that's wrong, change it to Navigate.


With the best regards,

Gonçalo

2020-03-01 17-52-33
Nikhil Gaur

You should change method property to "Navidate" of your link widget. Then it will work.

2020-01-10 18-28-17
Chris Kraack
Solution

I tried the Navigate and numerous variations. 

It does work this way: 

onclick="window.open('https://www.w3schools.com/tags/att_button_type.asp', '_blank');"

2020-03-01 17-52-33
Nikhil Gaur

Hi Chris,

Good to see that you were able to resolve your issue with this script, it will obviously work. 

But I am not able to understand why setting link's method property to Navigate and then using target="_blank" not working for you. 

I understand that this will not work for button but for link this is the standard way and should work in any case.

2020-01-10 18-28-17
Chris Kraack

Nikhil Gaur wrote:

Hi Chris,

Good to see that you were able to resolve your issue with this script, it will obviously work. 

But I am not able to understand why setting link's method property to Navigate and then using target="_blank" not working for you. 

I understand that this will not work for button but for link this is the standard way and should work in any case.

The only thing I could think of is maybe there is something taking precedence in my company's custom themes (set up by Outsystems).


2018-08-26 20-34-32
Pankaj pant

Chris Kraack wrote:

I am trying to open an external URL in a new browser tab.


The Service Studio version is 11.6.26 Build 9940


I believe it is coded properly, but it still displays the screen in the current tab.


I have tried the target="_blank" extended property and adding it to the Javascript Open URL.


Please let me know how to do this.   Thank you for your advice.


This is what is generated using the Button and the Link widgets :


#1 using a button widget:


<input target="_blank"

       onclick="window.location.href='https://some-URL','_blank'; return false;"

       type="submit"

       name="wt10$wt37"

       value="view order"

       id="wt10_wt37"

       tabindex="0"

       class="Button btn-small

       ThemeGrid_MarginGutter">



( I also notice this didn't end with />  )    



#2 using a link widget:


<a id="wt10_wt92"

   tabindex="0"

   target="_blank"

   onclick="OsAjax(arguments[0] || window.event,'wt10_wt92','wt10$wt92','','__OSVSTATE,',''); return false;"

   href="#">

   <span id="wt10_wtdisplayOrderNumber"

         class="btn btn-small background-blue" style="font-weight: bold;">

         {the-order-number}

   </span>

</a>



Hi Chris,

weather your are aware or not the target=_blank does't work with button. so in this case what you can do is style a link that  look like button.

with that link you can use target=_blank;


Best regards,

Pankaj Pant

2023-01-23 15-43-48
ranilson pereira da silva

Basta fazer isso, quando clicar nas propriedade do link, em Atributos (Propriedade: target e Value: "_blank". Pronto, quando o sistema tiver rodando, irá abrir o link em uma nova janela! Espero que ajude, é raro usar esse recurso, eu encontrei aqui na comunidade, porém não estava detalhado. 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.