question

markgoldin-3750 avatar image
1 Vote"
markgoldin-3750 asked markgoldin-3750 commented

SSRS report - all hyperlinks have target of _top

I am creating a hyperlink like this:
="<a href=""https://www.google.com"" target=""_blank"">Link</a>"
It works but I need to open it in the tab. When I inspect the element the target is set to "_top". I am also trying using this parameter:
rc:LinkTarget=_blank, but it's not helping. Any idea how to have hyperlinks opening in new tabs?

Thanks

sql-server-reporting-services
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

cooldadtx avatar image
0 Votes"
cooldadtx answered markgoldin-3750 commented

Where are you putting this expression exactly? Normally to add a hyperlink you put a Textbox on the report and set the URL using the Action section. That doesn't allow you to change the link behavior. The link behavior is determined by the client. For example while in the designer it'll open a new tab but in Report Manager it'll open in the same window if I remember correctly.

The only way I've seen to get it to open in a different tab is to use Javascript. Here's one possible approach.

="javascript:void(window.open('url', '_blank'))"


But you should test this to make sure it works and it might only work in a web app.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

My code goes into Expression, not Action. JS is no good, no worki in PDF, Word, .....
This parameter should be fixing it: rc:LinkTarget=_blank. Works in my simple test, but not in the real code.

0 Votes 0 ·
Joyzhao-MSFT avatar image
0 Votes"
Joyzhao-MSFT answered markgoldin-3750 commented

Hi @markgoldin-3750 ,

="<a href=""https://www.google.com"" target=""_blank"">Link</a>"

Now when your visitors click that link, it will open in a new window or tab (depending on which web browser they are using and how they configured that browser).
Note that if your web page uses the "strict" DOCTYPE of XHTML 1.0 or 1.1, you will not be able to do the above and still have your page validate as correct.
For more information,please refer to: How to Make Links Open in a New Window or Tab.
Redirect to report viewer page in a new window.
Best Regards,
Joy


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

<Now when your visitors click that link, it will open in a new window or tab
No, it will not. Put a simple report together and inspect hyperlink element. You will see target="_top", although your expression says _blank.

0 Votes 0 ·