如何在使用.rdlc XML文件时在新窗口打开超链接?
Hey there, let's fix this so your link doesn't take over the current page! First, here's your original code for reference:
<Action> <Hyperlink>=www.google.com</Hyperlink> </Action>
The issue here is that there's no instruction telling the browser to open this link in a new tab or window—so it defaults to replacing the current page.
To fix this, we need to add the target="_blank" attribute to your <Hyperlink> tag. This is the standard way to tell browsers to open links in a new browsing context.
First, a quick note: I noticed your original tag uses = to set the URL—if that's the correct syntax for whatever framework or tool you're using, you can adjust it like this:
<Action> <Hyperlink>=www.google.com target="_blank"</Hyperlink> </Action>
But more commonly, hyperlink tags use an href attribute for the URL, with target as a separate attribute. If that's the case for your setup, use this instead:
<Action> <Hyperlink href="www.google.com" target="_blank">Go to Google</Hyperlink> </Action>
And as a bonus security tip: When using target="_blank", it's smart to add rel="noopener noreferrer" too. This stops the new tab from being able to access your original page's window object, which helps block some potential phishing risks. Here's the secure version:
<Action> <Hyperlink href="www.google.com" target="_blank" rel="noopener noreferrer">Go to Google</Hyperlink> </Action>
That should do the trick! Now your link will open in a new tab or window (depending on the user's browser settings) instead of replacing the current page.
内容的提问来源于stack exchange,提问作者Kartik Raja S

