Is PhoneGap on iOS hard coded to load www/index.html?

前端 未结 4 524
花落未央
花落未央 2021-02-06 06:30

On PhoneGap on Android you can modify the App.java class to load any url. I can\'t find anywhere to change the entry point on the iOS version.

When testing I prefer to h

相关标签:
4条回答
  • 2021-02-06 06:48

    You could do this:

    Create the default index.html and have it wrap and load your own html root file, that way you can keep your own directory structure and no need to do any modifications there.

    Of course, phonegap is open source, so you could also commit a change to phonegap to change the iOS api similar to Android API. Currently it seems the root html file path is determined in class PhoneGapDelegate.m

    0 讨论(0)
  • 2021-02-06 06:53

    you could do it

    class/ AppDelegate.m

    change self.viewController.startPage to ur startpage in AppDelegate.m

    0 讨论(0)
  • 2021-02-06 06:58

    As of PhoneGap 2.2, you can now override the <content> tag in your config.xml:

    <content src="http://www.example.com" />
    
    0 讨论(0)
  • 2021-02-06 07:01

    PhoneGapDelegate.h defines a class method startPage which you can overload/redefine in your iOS app's AppDelegate.m file.

    + (NSString*) startPage;
    

    For example:

    + (NSString*) startPage{ 
        return @"http://m.google.com";
    }
    

    Will redefine the start page in PhoneGap. You will have to add google.com to your ExternalHosts in PhoneGap.plist. As of PhoneGap 1.2 If you do this and include Plugins in your native app, remotely host PhoneGap apps and their related *.js WILL be able to preform plugin actions. I've tested this with BarcodeScanner, ChildBrowser and ApplicationPreferences.

    UPDATE

    As of 1.4.0 and 1.4.0, startPage and wwwFolderName are properties instead of methods. They are still redefinable, but you can no longer have startPage point to a remote (non-local) phonegap installation like in my above example. (Which is kind of a bummer)

    0 讨论(0)
提交回复
热议问题