Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set headers in Cordova InAppBrowser?

In an app I'm building using the ionic framework (based on Cordova) I'm using the Cordova InAppBrowser to visit a url, but I want to set custom headers for that request. I've read over the readme and some other sites, but I can't find anything.

Does anybody know how I can set headers in the Cordova InAppBrowser? All tips are welcome!

like image 579
kramer65 Avatar asked Mar 27 '15 11:03

kramer65


People also ask

How do I use InAppBrowser in Cordova?

function openBrowser() { var url = 'https://cordova.apache.org'; var target = '_blank'; var options = "location = yes" var ref = cordova. InAppBrowser. open(url, target, options); ref. addEventListener('loadstart', loadstartCallback); ref.

What is InAppBrowser in Android?

The InAppBrowser is a web browser view that displays when calling [window. open](window. open. html)() , or when opening a link formed as <a target="_blank"> .

How do I close InAppBrowser?

There is no action to close the InAppBrowser. How can we achieve this? The user is redirected to an aws login page in the IAB and after suscessfull login the IAB should close and the user should be redirected to a screen in the app.


1 Answers

As far as I now know this could not be done. So I opted for an alternative solution in which I gave the params via the url. I could do this because I also controlled the url which I wanted to open. So it worked, but it wasn't ideal.

Anyway, maybe this can help other people.

like image 99
kramer65 Avatar answered Sep 17 '22 20:09

kramer65