How to view current browser url using ASPX NET C #?

How to see the current browser url?

Does the user come to my page directly through www.mypage.com/myapp or through apps.facebook.com/myapp

+3
source share
2 answers

Is this javascript?

You can use:

alert(location.href);

Or:

alert(document.referrer);

The first shows the current location, and the second shows (as you requested) where the user came from.

Edit: I see that you are marked as Asp.net when you use client-side coding, there is no ASP.NET, but only javascript (strictly speaking, but ASP.NET can manage the client side through AJAX / JS).

, , iframe ( ) - .

+2

JavaScript document.referrer , . ( iframe), window.location.href url .

0

Source: https://habr.com/ru/post/1751155/


All Articles