How to retrieve the resolved url
I have a windows authenticated site. When I load the URL in browser, it will redirect automatically by logging into the 开发者_如何学JAVAweb site using Windows Authentication. I am trying to get a request to a site using JavaScript, also I am able to alert the resolved page data i.e. even through JavaScript windows authentication is done.
My question is after resolving to the authenticated page, my page URL also get changed, so is there any way to retrieve the URL...
For suppose if I give http://mysite.com then after authentication it is resolved to something like this http://mysite.com/{user-id}
Now I want to get the user id using JavaScript. Can some one please help me here...
You can get the URL with window.location
.
If your URL really is as simple as http://mysite.com/1
, for example, you can get the ID with
var user_id = parseInt(window.location.pathname.substr(1), 10);
精彩评论