I meet this interesting situation:
<ul> @foreach (var item in Model) { <li> <a href="@Url.Action("Details", "Product", new { id = item.Id })" >@item.Name</a> </li> } </ul>
When I click a link, nothing happen, product Details page does not open. But I do "Open link in new tab", then it opens. What can be it's reason?
Links may be broken for a variety of reasons, including the URL being mistyped, the webpage no longer being online, the page's URL having changed, or the linked page having restricted access (such as by being behind a password or firewall).
How to Open Hyperlinks in a New Browser Tab or Window. The short answer is: just add a target="_blank" attribute to your links (anchor tags). 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).
Go to the link you want and press Ctrl+Enter to open in a new tab or just Enter to open in the same tab. You can use Shift+Enter to open it in a new window.
You just need an anchor ( <a> ) element with three important attributes: The href attribute set to the URL of the page you want to link to. The target attribute set to _blank , which tells the browser to open the link in a new tab/window, depending on the browser's settings.
You have some javascript code which is preventing the default action of the anchor tag to be executed. You could inspect the Network
tab in FireBug or Chrome DevTools to see if some AJAX request is being made when you click on the link. You could try excluding javascript files until you find the one that is doing this.
Maybe you prevented the redirection event of a tag with JavaScript.
For example:
$(document).on('click', 'a.thatTag', function (e) { // ... e.preventDefault(); });
.preventDefault()
prevents redirection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With