• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Change "Request type" from GET to POST for a request via href

Explorer ,
Sep 30, 2014 Sep 30, 2014

Copy link to clipboard

Copied

I am requesting a cfm page by clicking on a link (<a href="admin/index.cfm">Admin</a>). While checking the network traffic in IE developer tool I can see the Request type as "GET". I need to change this to POST method. Is there any way to do this?. I know this is browser's default behaviour.

Views

2.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 01, 2014 Oct 01, 2014

Copy link to clipboard

Copied

<form action="admin/index.cfm" method="post">

<input name="sbmt" type="submit" value="Admin">

</form>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 01, 2014 Oct 01, 2014

Copy link to clipboard

Copied

If you insist on a link:

<script type="text/javascript">

function submitForm()

{

  document.myForm.submit();

}

</script>

<form action="admin/index.cfm" method="post" name="myForm">

<input name="message" type="hidden" value="They are on the way!!!">

</form>

<a href="javascript: submitForm()">Admin</a>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 07, 2014 Oct 07, 2014

Copy link to clipboard

Copied

LATEST

Agreed.... You posted the same solution as I found and you answered the question. But I was expecting a generalized solution, in fact my question should have been more specific and sorry for missing that out.  I will elaborate my question little more as below.

Suppose I have many templates with many links , say 10. In this case I need to apply the solution , that you posted above , for each and every link. Here I can find a generalized solution by writing a common javascript function (using Jquery) in a separate js file and including it in a place to be accessible for all the templates. For each and every link I will provide same class name and in the javascript function using this selector (same class name) I will submit the form with a POST method as you explained above. This way we can change the request type from GET to POST for any links used in the application.Correct me if I am wrong in this approach. If I am wrong is there any other better generalized approach which can be used?.

Also I would like to tell you one thing that the PCI scanner fund this (changing request type from GET to POST while clicking on link(s) ) as a security concern even though there is no sensitive date found. That is the reason why I am trying to figure out a solution to change the request type from GET to POST while clicking on a link(s). I strictly believe , with my knowledge , that this should not be a security concern unless there is some sensitive data. Note that I am not asking a second question here but I am just telling you the reason why I opened this thread here.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation