External links in phonegap app do not open well

前端 未结 5 511
夕颜
夕颜 2020-12-05 01:05

So I have a phonegap project with Phonegap 2.9.0 and building with PhonegapBuild.
I got external links in my app, that I would like to open inapp or using the default de

5条回答
  •  猫巷女王i
    2020-12-05 01:53

    IF External links do not open, READ ON.

    UPDATE: 2016-03-20 I've create a tutorial on this subject.

    Tutorial: Phonegap Build external webpage in iframe with whitelist example

    If you are reading this you may notice that this Post refers to 2.9.0 for Cordova/Phonegap/Phonegap Build. 2.x is officially deprecated and no longer supported.

    If you are using 2.X and you want to continue developing your App, upgrade.

    If you are compile with 3.x, 4.x or 5.x or better, read on.

    If you googled something like External links do not open, then here is what you should know. In Sept & Oct of 2015, Cordova and Phonegap made some major changes. These changes put into effect white-listing

    White-listing means you *MUST* provide the system with a white list of the external links you plan on using. The entire system can be confusing. I am currently working on a blog post, but until then here is what you need to know.

    The white-list system has three (3) parts

    • The white list provide in your config.xml
    • The white list plugin which you add to your config.xml
    • CSP (Content Security Policy) which is place on every webpage (only once, if you do SPA)

    The application is not straight forward. If you are using version 3.x, then you do NOT need any of this. If you are using 4.x or better, this applies to you. If you are using 5.x, there even more rules that apply. Like I said, I'm working on a blog post, but this white-list thing is so onerous, I need to get the word out.

    Here are the links you need to get started.

    • Latest whitelist plugin
    • Phonegap Whitelist Guide
    • Phonegap Build Whitelist Guide

    There is more explanation here:
    Timeout AJAX Requests Cordova 5

    In addition, you can read #10 of Top Mistakes by Developers new to Cordova/Phonegap

    If you are brave, you can read my *RAW* notes at Cordova/Phonegap the white-list system

提交回复
热议问题