SidC
SidC

Reputation: 3203

How to Add an HREF using Javascript?

I have an ASP.NET 4.0 site that has links to another ASP.NET site (different domain name). In situations where users from domain 1 are directed to a page on domain 2, how would I setup a Javascript routine to create an href back to domain 1? That is, I don't want to place a solid <a> tag on domain 2 pointing back to domain 1. Rather, I need a little bit of script magic that only makes the href available to users coming from domain 1. Can anyone suggest a specific Javascript library/widget that functions in this manner?

Upvotes: 0

Views: 507

Answers (1)

amit_g
amit_g

Reputation: 31250

Do you have to do this in javascript? You can use the Request.UrlReferrer in the asp.net page to see where the request came from and using that you can make the link.

Uri LastUrl = Request.UrlReferrer;

Upvotes: 1

Related Questions