Client-side detection of HTTP request method
Is it possible to detect the HTTP request method (e.g. GET or POST) of a page from JavaScript? If so, how?
Solution 1:
In a word - No
Solution 2:
I don't believe so. If you need this information, I suggest including a <meta>
element generated on the server that you can check with JavaScript.
For example, with PHP:
<meta id="request-method" name="request-method" content="<?php echo htmlentities($_SERVER['REQUEST_METHOD']); ?>">
<script type="text/javascript">
alert(document.getElementById("request-method").content);
</script>