Windows Phone 8 Ionic app navigation issue(Hybrid

2020-04-21 08:37发布

问题:

I am developing an hybrid app for Android and WP8 using Ionic. It works fine on Android platform but when I recently used this on WP8, its showing me

"You need to install an app for this task. Would you like to search for one on the Store?"

When I click on some links (internal app links). Please can anybody tell me why this is happening. Thanks in advance.

回答1:

Problem In windows phone Due to ms-appx IE problem :

When you use ng-href and dynamic url's in your app on Windows Phone, for example:

<a ng-href="#/view/"> click here </a>

You will notice that when you click on the url, you get a message "Search for app in appstore?". You receive this message because AngularJS can't handle the prefix that Windows Phone IE is adding.You can resolve this easily by adding an HTML5 him to your app.

    .config([
      '$compileProvider',
      function ($compileProvider)
        $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|ghttps?|ms-appx|x-wmapp0):/);
        // Angular before v1.2 uses $compileProvider.urlSanitizationWhitelist(...)
      }
    ])

And if local & dynamic images are not showing in app then add following same as your app.js

 $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|file|blob|content|ghttps?|ms-appx|x-wmapp0):|img\//);

For more details to check here link1, link2 ,link3 and link4.



回答2:

Install cordova-plugin-inappbrowser



回答3:

In relation to this posting What is x-wmapp2 and x-wmapp1? it could also be diserable to have something like this:

$compileProvider.aHrefSanitizationWhitelist( /^\s*(g?https?|ftp|mailto|tel|file|local|ms-appx|x-wmapp\d+):/ );

Instead of only x-wmapp0 I am using x-wmapp\d+ in my regex.