Dabbas
Dabbas

Reputation: 3230

How know the current url before requesting general handler using ajax ?

I think the title isn't clear enough because I didn't know how to ask it.

What I'm doing is requesting general handler using ajax and I want to know the current url of the page, I think I can use javascript method to get the current url and send it with the request as parameter, but the problem is that the user can change the url before clicking the button and sending the request so I'll never knew if this is the real url.

Any idea how can I do it ?

Many thanks

Upvotes: 0

Views: 157

Answers (2)

goenning
goenning

Reputation: 6654

I think that the safest way is to get it from the server-side. You can use this.Request.UrlReferrer to get this information.

Upvotes: 1

Mike Lin
Mike Lin

Reputation: 370

I think window.location.href is always the real url.

Upvotes: 0

Related Questions