-1

I am working on cordova windows app .After login page submit, there will be an authentication web service, which will redirect to one particular url in my application.

But in my app, after login submit, the redirected page is opening in internet explorer instead of opening in application view itself. The redirected cross domain url is not opening in application view. But it opens internet explorer and opening the page. It should not happen like this.

Since it is opening in internet explorer browser ,instead opening in application view,login is not successfully happening.

Could any one help me on this issue ?

We are using windows 8.1 and cordova version 5.3.0 .

The same problem I faced in android app also .But after I added allow -navigation tag in config.xml (This is part of whitelist cordova plugin), The redirected page opened correctly in application view itself. But cordova white list plugin not supporting windows cordova app.

1 Answers1

0

Install this plugin cordova-plugin-inappbrowser.

When successfully installed, your code should look kinda like this.

Code example:

<button id="login">Log in</button>

var btn = document.getElementById("login").addEventListener("click", login, false);

function login() {
    var ref = cordova.InAppBrowser.open(
        'link_to_the_website',
        '_system',
        'location=yes');
}

You have three type of options to load the URL.

  • _self: Opens in the Cordova WebView if the URL is in the white list, otherwise it opens in the InAppBrowser.
  • _blank: Opens in the InAppBrowser.
  • _system: Opens in the system's web browser.
Ray Joe
  • 182
  • 1
  • 2
  • 11
  • Hi Joe, Thanks for your valuable response. But we are using form submit. We have a web service url in form's action attribute. And we have a hidden variable in the form with value "lin_to_the_website". When we submit the form using submit button, it should go to the webservice url , authenticate the user's credentials given in login form and then the authenticating service should redirect to the url given in the hidden fiedl of the form. It is perfectly working in android and ios devices but not in windows 8.1 app. – Premkumar Mohanram Nov 17 '15 at 07:09
  • In windows 8.1 app it is not authenticating even we don't know whether the submitted login credentials have been received by the web service url or not . The authenticated web service is not allowing us to login in windows 8.1 app. we don't know why form submit with all the input element values is not happening in windows 8.1 app. As you mentioned in the comment, we can't even directly give the web site url in button action. It should be form submit with web service call which is not happening. There is cordova plugin called white list which is not working in windows 8.1 app – Premkumar Mohanram Nov 17 '15 at 07:11
  • Hi Joe,Even after adding cordova inapp browser as per your code, After clicking the button , the external web page is opening in internet explorer instead of opening with in the application itself. That means when click the app icon , it will open the app and within the app if i click the button with listener, the url is opening besides the app that means near to app but in internet explorer – Premkumar Mohanram Nov 17 '15 at 12:40
  • . It is opening like once we click the button next second browser is opening near to the app itself . This is same like a book's two page. One side is app where button is there and other side is internet explorer where external link is opening. May i know how to open this external url with in the app itself ? – Premkumar Mohanram Nov 17 '15 at 12:40
  • my external link should open with in the application itself . That means not in IE not in system browser but within the app itself . I should not loose my control on app but it can completely go to that url within my app itself – Premkumar Mohanram Nov 17 '15 at 12:42
  • Did you use _self or _blank? – Ray Joe Nov 18 '15 at 01:46
  • I used both _self and _system. Both opening the app in internet explorer only and not in cordova app view.According to the documentation for InAppBrowser, the _blank target loads the page in the InAppBrowser, and not in the Cordova View. This means that the webpage that is loaded doesn't have access to the Cordova API.so I could not use _blank also. Could you please help me providing any other solutions ? I am stuck up with this problem in my project. – Premkumar Mohanram Nov 18 '15 at 07:09
  • All _blank,_self and _system not opening the link in cordova app view .so it does not help me. Please help me with some other solutions. – Premkumar Mohanram Nov 18 '15 at 07:10
  • The website which is loaded in cordova web view should have access to the cordova apis such as camera, barcode scanner in windows 8.1 app. Is it possible ? Finally I want to load an external web site inside a cordova mobile app on windows so that it has access to the cordova apis such as camera, barcode scanner.Please help me on this. – Premkumar Mohanram Nov 18 '15 at 09:41
  • Hi Joe, I have seen two relative link with this same problem. They are : – Premkumar Mohanram Nov 18 '15 at 10:09
  • http://stackoverflow.com/questions/28049355/is-it-possible-to-load-an-external-website-inside-a-cordova-mobile-app-on-window?rq=1 – Premkumar Mohanram Nov 18 '15 at 10:09
  • http://stackoverflow.com/questions/26893007/how-to-load-a-remote-javascript-app-into-a-cordova-windows-phone-8-1-app-and-hav – Premkumar Mohanram Nov 18 '15 at 10:09
  • Please let me know will it be helpful ? – Premkumar Mohanram Nov 18 '15 at 10:09
  • We tried the cordova plugin https://github.com/manifoldjs/ManifoldCordova .But this also opens the start up url in IE only instead opening in cordova web view. Please help me on this. – Premkumar Mohanram Nov 18 '15 at 13:56
  • Could any one help with this issue ? – Premkumar Mohanram Nov 19 '15 at 09:20
  • pls help me on this issue – Premkumar Mohanram Nov 20 '15 at 13:57
  • Could any one help me on this issue ? – Premkumar Mohanram Dec 10 '15 at 06:30