Cap-go / capacitor-inappbrowser

Capacitor plugin in app browser with urlChangeEvent
MIT License
58 stars 38 forks source link

Can i add text/html;ba64 as url? #24

Open Gautammer opened 1 year ago

Gautammer commented 1 year ago

Like this?

var pageContent = '<html><head></head><body><form id="loginForm" action="' + url + '" method="post">' +
    '<input type="hidden" name="username" value="' + this.userName + '">' +
    '<input type="hidden" name="pwd" value="' + this.decryptedPass + '">' +
    '<input type="hidden" name="mobile_token" value="123xyz">' +
    '</form> <script type="text/javascript">document.getElementById("loginForm").submit();</script></body></html>';

  var pageContentUrl = 'data:text/html;base64,' + btoa(pageContent);

  InAppBrowser.open({
     url:pageContentUrl,
     headers:{
        backgroundColor:'#ffffff'
     },
     isPresentAfterPageLoad:true
  }).then(res=>{
    console.log(res);
  },err=>{
    console.log(err);
  })

Thanks :)

riderx commented 1 year ago

Hello thanks for the answer i'm not sure it's supported by the native browser of platform, but the best is you to try !