Link is not opening in new tab

Link is not opening in new tab

  
Hello Team,

I am assigning link on button control. I am assigning target="_blank" property to the link. It should open link in another tab, but link is getting opened in same tab. I am using this link for External URL.



Am I doing anything wrong over here or is this the bug in version 9.0.1.55? Do I need to verify applications developed in version 8 and migrated to version 9?

Please advice.

Thanks and Regards,
Suraj Borade

Hi Suraj,

I didn't realise that approach could work in version 8.

In version 9.0.1 the generated code is:

<input target="_blank" onclick="window.location.href='http://google.com'; return false;" type="submit" ...>

That won't work, unless you change it to:

<input type="button" value="New Tab" onclick="window.open('http://www.example.com')">

Nevertheless, please consider to change it to one link (<a>), you can add css styles to transform your link into a button.

Hope it helps you.
Hi Daniel,

Thanks for the inputs. But I clearly remember, I have implemented same functionality in version 8 almost one year before. On link, where I want to open external URL, I have provided proerty, target="_blank". That app is already in production and I haven't received any complain from business users when we upgraded to version 9 means it is working fine.

In this URL, I want to pass dynamic values as well through input parameters. How can I do that with 'window.open'?

Thanks and Regards,
Suraj Borade

Hi,
it should be working imho.
So strange it doesn't work.


what is the rendered html for that button?
does it render the target-tag?

Hi J,

Here is an generated HTML for that button, 

<input target="_blank" onclick="window.location.href='http://analytics.xyz.com/analytics/saw.dll?Dashboard&amp;PortalPath=/Shared/GMDM/_portal/Product%20Dashboard%20%2D%20IDD&amp;Page=MDM&amp;Action=Navigate&amp;P0=2&amp;P1=eq&amp;P2=%22Fact%20%2D%20Comm_Brief_View%22.DESCRIPTION&amp;P3=Echelon 13&amp;P4=eq&amp;P5=%22Dim%20%2D%20Pkgd%20Product%22.PLC_PHASE&amp;P6=Copy%20Doc%20Complete'; return false;" type="submit" name="xyzTheme_wt3$block$wtMainContent$wt2$wt5$wt2" value="Generate Copy Doc Report" id="xyzTheme_wt3_block_wtMainContent_wt2_wt5_wt2" tabindex="49" class="Button Is_Default">

Thanks and Regards,
Suraj Borade
Hi Suraj,

Try to replace target with formtarget attribute.

The formtarget attribute specifies where to display the response after submitting the form. This attribute overrides the form's target attribute.

The formtarget attribute is only used for buttons with type="submit". (http://www.w3schools.com/tags/att_button_formtarget.asp)

Hope it helps,

André Siébra