Possible Duplicate:
Client-side detection of HTTP request method
I’m working on Javascript that is injected on any page. The script is injected on servers that I’m not controlling. (Injection is done with an add-on or bookmarklet.)
The Javascript needs to know whether the page was loaded as the result of an HTTP GET or POST. The reason for this is that if the page was loaded with a GET, the URL is an identifier for the page that can be bookmarked, shared with others, etc. In case of a POST, I need to handle it differently.
Can this be done? I have found no way of accessing the request from Javascript, but perhaps there is some trick that I don’t know of.
I think you can’t.
Brendan Eich just confirmed that last night on his twitter, in a conversation with dhh.
Reproducing here:
I suggest you follow both in case you are interested on this matter.
In the meantime, I think the best you can do is having two different javascripts – one for POST pages and another one for the rest. You give both to your providers and tell them how to use them. But yes, this involves cooperation from the servers.