Search code examples
javascriptcordovawindows-10cordova-plugins

Cordova InAppBrowser Plugin - Windows 10


I am desperately trying to get an old cordova project up and running as a Windows 10 UAP app. So far it is looking quite well, but a core part of the app is the use of the InAppBrowser of Cordova, and it just does not seem to be working.

Versions:

  • Cordova: 6.3.1
  • cordova windows: 4.4.2
  • cordova-plugin-inappbrowser: 1.4.0

So I have managed to build my app using cordova for windows and the Windows 10 SDK. Apart from the plugin it is working fine.

I installed the plugin like it is shown in the documentation:

cordova plugin add cordova-plugin-inappbrowser

After that, I wanted to replace window.open by cordova.InAppBrowser.open, also as suggested in the documentation.

onDeviceReady: function() {
    window.open = cordova.InAppBrowser.open;
}

I am calling my links like this:

var ref = window.open(url, '_blank', 'allowInlineMediaPlayback=yes');

However, in the Windows 10 app, the sites always get opened in my default browser.

I have already made sure that I do not have any old plugin files in my project.

Is it possible that Windows 10 is not supported yet for the InAppBrowser plugin? Because I can find no specific mentions on the project page of cordova.

I would appreciate any kind of hint or solution.

Thanks for reading.

EDIT: I just solved it myself :) I found out, that the deviceready has never been triggered. After further investigation I found out that cordova.js was not found. This was due to my folder structure. I had a www folder in the www folder, so I had all the folders like plugins twice. This lead to the problem that MsBuild did not find the cordova.js.


Solution

  • I just solved it myself :) I found out, that the deviceready has never been triggered. After further investigation I found out that cordova.js was not found. This was due to my folder structure. I had a www folder in the www folder, so I had all the folders like plugins twice. This lead to the problem that MsBuild did not find the cordova.js.