简体   繁体   中英

Phonegap with page.js routes works only on desktop

I am using page.js in an HTML+CSS+JS app.

The routes work perfectly in browser, even using the "phonegap serve" and accessing my_ip:3000.

But when I try to load it in my phoneGap Developer (in an Android phone), only the first route loads (if I try to navigate through the app links, I get only blank screens).

When using page.js in mobile apps (with cordova, phonegap or cocoon), just use:

page( { dispatch: false } )
page( '/' )

Instead of:

page()

You can replace '/' with the first route that you want your app to start with.


In details:

Normally, in a web app, you use page() to start the routing process and, of course, it will identify which route is being requested and call the correspondent function.

Since in mobile we don't have an URL request, we disable this identification process with dispatch: false and pass a default start route.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM