Can I POST to a new window that I intend to open?

Is this feasible?

  1. A 3rd party website is running my Drupal component
  2. An end customer clicks a link which will certainly:
  3. Open up a new window www.mysite.com/redirect.php
  4. and also POST particular information to this web page www.mysite.com/redirect.php

I've seen the customer is internet browser being rerouted, yet am unclear on just how to do the above.

0
2019-05-18 21:39:06
Source Share
Answers: 1

If you simply desire a link that opens up a POST - asked for web page in a new window below are some suggestions. Nonetheless, realize a POST demand can not be bookmarked.

  • You can make a switch that opens up a POST - asked for web page in a new window.

    <form method="post" action="http://example.com/example.php"
      target="_blank">
    <input type="hidden" name="name1" value="value1">
    <input type="hidden" name="name2" value="value2">
    <input type="submit" value="Open results in a new window"> 
    </form>
    
  • If you desire it to resemble a link, you can make a relate to an onClick feature that sends the kind.

    <form name="myform" method="post" action="http://example.com/example.php"
      target="_blank">
    <input type="hidden" name="name1" value="value1">
    <input type="hidden" name="name2" value="value2">
    </form>
    
    <a href="http://example.com/example.php"
      onClick="document.forms['myform'].submit(); return false;">Open results
      in a new window</a>
    

    The onClick component sends the kind, which opens up the POST - asked for web page in a new window. The return false protects against the internet browser from additionally mosting likely to the href address in the existing window at the very same time. If Javascript is impaired or the link is bookmarked, the href address is made use of as a contingency, yet the resulting web page will not receive any kind of POST values. This could be complex or hostile for your customers if they bookmark the link.

If you desire the link to be bookmarkable, explore if your web page can approve GET parameters. If so, after that you can make a bookmarkable link.

 <a href="http://example.com/example.php?name1=value1&name2=value2"
   target="_blank">Open results in a new window</a>
0
2019-05-21 05:14:12
Source