You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/02/04 05:36:04 UTC

[GitHub] [cordova-plugin-inappbrowser] sachin-udchalo edited a comment on issue #779: Posting form data to wkwebview is not working

sachin-udchalo edited a comment on issue #779:
URL: https://github.com/apache/cordova-plugin-inappbrowser/issues/779#issuecomment-773043158


   I was doing a form post by creating a local file and opening that URL inside the WKWebView.
   `
   export function getRedirectUrl(redirectData) {
     if (redirectData && redirectData.postData && redirectData.URL) {
       const postData = redirectData.postData;
       let inputFields = '';
   
       for (const key in postData) {
         inputFields = inputFields + `<input type="hidden" name="${key}" value="${postData[key]}">`;
       }
       const htmlString = `<html><head><title>Check Out Page</title></head><body><center><h1>Please do not refresh this page...</h1></center><form method="POST" action="${redirectData.URL}" name="paymentForm">${inputFields}</form><script type="text/javascript">document.paymentForm.submit();</script></body></html>`;
       const file = new File([htmlString], 'paymentForm', { type: 'text/html' });
       return window.URL.createObjectURL(file);
     }
     return redirectData;
   }
   `
   This file didn't got opened in WKWebView. Insted an instance with about:blank got opened and there were no errors or cors issues when I debugged it in safari.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org