ash84
ash84

Reputation: 817

window.open() in Android4.1 and iOS environment

I submit form data to windows popup. Below codes:

<form name="submit_form">
    // input any datas
</form>

window.open("", "_blank", status);
document.sumit_form.target = "_blank";
document.sumit_form.action = "https://example.com";
document.sumit_form.method = "POST";
document.sumit_form.submit();

In desktop environment, create a popup and show "https://example.com" with form data. But, only show empty page on the webview of app in Android 4.1 and do not create new page on UIWebView of app in iOS device.

what is problems? window.open() is wrong?

Upvotes: 0

Views: 170

Answers (1)

mplungjan
mplungjan

Reputation: 178008

  1. Give it a name to submit to - _blank will always open a new window or tab.
  2. you need to use "status" if you want to give a parameter - in most browsers, status cannot be turned off anyway
  3. If you still have problems, use setTimout to give the browser a chance

Like this

window.open("", "myWin","status");
setTimeout(function() {
  document.submit_form.target = "myWin";
  document.submit_form.action = "https://example.com";
  document.submit_form.method = "POST";
  document.submit_form.submit();
},1000);

Upvotes: 1

Related Questions