Sign up ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

I'm trying to add a link to a page. The link should contain the current URL in a querystring (to be used as a ReturnUrl) and it can contain a hash.

Middle-clicking, right-clicking and ctrl+clicking should be supported. For example, middle-clicking will open the link in a new tab with (or without) the querystring.

Is this completely off-track, or how can I improve it?

<a href="@Url.Action(MVC.Links.ThereAndBackAgain())?ReturnUrl=" onclick="this.href += encodeURIComponent(location.href)">
share|improve this question
    
The last request for the implementation appears to be off-topic. We can only review what's present here. – Jamal Oct 6 at 19:03
    
Removed the last request – thomius Oct 6 at 19:04
    
I believe you can skip the JS, and just append the URL in asp.net using the request object stackoverflow.com/q/5304782/575527 – Joseph the Dreamer Oct 7 at 0:51
    
@JosephtheDreamer Hash should be preserved. Updated the answer (see this stackoverflow.com/questions/3664257/… or this stackoverflow.com/questions/317760/…) – thomius Oct 7 at 4:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.