Want Hyperlink to Open in a New Window
Greetings. I have added a hyperlink to a report, and it works like a charm. Now I would like to change it so that when the link is clicked on, it opens the URL in a new browser. I cannot seem to find any information out there on this issue. Has anyone figured out how to do this?Here is the RDL from the report I'm working with:
<Action>
<Hyperlink Target="_blank">
=Trim(Fields!sfa_WebServer.Value) & "SFADetail_IntakeCoordinator.aspx?Record=" & Fields!url.Value
</Hyperlink>
</Action>I added the Target="_blank", thinking that would take care of it, but it had no impact.Thanks for any help you can offer.
Erik
You have to use a hyperlink expression like this:
=void(window.open(' http://www.xyz.com"','_blank'))"
Note: be careful with single vs. double quotes when doing VB string concatenation vs. Javascript strings.
-- Robert
Thanks for the reply. I think I am getting close! I modified my code, per your suggestion, and it now looks like this:
<Hyperlink>
=void(window.open('" & Trim(Fields!sfa_WebServer.Value) & "SFADetail_IntakeCoordinator.aspx?Record=" & Fields!url.Value & "','_blank'))"
</Hyperlink>
When I try to preview the report, I get the following error:
"The url BLOCKED SCRIPTvoid(window.open('http://nbrwb02:8080/SFADetail_IntakeCoordinator.aspx?Record=7','_blank')) has an invalid schema. URLs in reports may only use http://, https://, ftp://, mailto: or news:"
From my point of view, the good news is that the url in the error message is correct, so my fields are being read correctly. Unfortunately, I cannot get around this error yet.
="javascrippt:void(window.open(' http://...','_blank'))" works fine for me. Please note that javascrippt is misspelled on purpose. For some reason, if spelled correctly, the post was losing the string.
Okay, it's working now, sort of. I downloaded SP2, and now I don't get the error I referred to earlier in this thread.
There is just one little hitch. When I click on the link, two windows open. Here are the two urls I get.
First window:
javascrippt:void(window.open('http://www.yahoo.com))
(Note: javascrippt is intentionally misspelled in this forum so that it is not deleted).
Second window url:
http://www.yahoo.com
Any ideas on what I should do to get rid of the first window?