Единственный способ, который я нашел, чтобы решить вашу проблему - это клонировать весь элемент формы, скрыть его, чтобы он не отображался, добавить его в новое окно и затем отправить его.
Я использовал этот код JavaScript и работал нормально во всех браузерах:
/**
* Sending form in a new window function
*/
function submitInNewWindow(event) {
// Prevents default so the form won't be submitted
event.preventDefault();
// SOme variables
var win, container;
// Opens the new window
win = window.open('about:blank', 'Frame', 'top=0, left=0, width=250, height=250, location=no, status=1, toolbar=0, menubar=0, resizable=1, scrollbars=1');
// Creates a container to hold the cloned form
container = win.document.createElement('div');
// Gets the form HTML and uses it as the container HTML
container.innerHTML = document.getElementById('form').outerHTML;
// Hides the container
container.style.display = 'none';
// Injects the container in to the new window
win.document.body.appendChild(container);
// Submits the new window form
win.document.querySelector('form').submit();
}
// Gets the form element
var form = document.getElementById('form');
// Attachs the event (for modern browsers)
if(typeof form.addEventListener === 'function') {
window.addEventListener('submit', submitInNewWindow, false);
}
// Attaches the event for old Internet Explorer versions
else {
form.attachEvent('onsubmit', submitInNewWindow);
}
HTML:
<form action="http://localhost/test/" id="form" name="form" method="post" target="Frame">
<input id="field1" name="field1" type="hidden" value="1234" />
<input id="field2" name="field2" type="text" value="5678" />
<input type="submit" value="send">
</form>
Я тестировал его в Internet Explorer 11, Edge, Chrome (Mac / PC), Firefox (Mac / PC) и Safari.
Надеюсь, это поможет!