How to submit form with "target" attribute


#1

Form with “target” attrubute not post any data.

After submitting form with target=’_blank’ (or target=‘windowname’) Electron open new window, load page from “action” attribute, but POST data is empty. It is a bug?!

For example, in main.js:
mainWindow.loadUrl(‘https://some.external.domain…/electron-submit.php’);

electron-submit.php:

<html>
<form method='post' id='form1' name='form1' target='_blank' action='electron-submit.php'>
<textarea id='data1' name='data1'>Some text</textarea><br>
<input type='submit' value='Submit'/>
</form>
<?php print_r($_POST); ?>
</html>

With “target” attribute will display Array ()
Without “target” attribute will display Array ([data1] => Some text)

How to submit form with “target” ?


[Bug] Post form with "target" attribute sending GET request instead of POST
[Bug] Post form with "target" attribute sending GET request instead of POST
#2

The problem is more serious.
With the attribute “target” Electron used the wrong method GET request instead of POST.


#3

The issue is that you’re trying to use PHP with Electron. It does not support PHP.


#4

You do not understand the problem. Electron incorrectly sends HTTP request to the server. The request must be POST method, but Electron sends GET. The server and programming language on the server side can be any. Electron should not be support PHP.