Cordova (phonegap build) white page now?

the adress is “file:///android_asset/www/index.html” but i thing on ios it will be different.
some dynamic option would be good hm

pushStateRoot: Framework7.device.ios ? 'ios-url-here' : 'android-url-here'

okay now it work i added /index.html and /index.html to index.html and routes.js

maybe we can remove file:/// and index.html from document.location.href for dynamic out of box work?

why it is needed now and on the f7 v1.* not.

it is not really easy anymore, because now i have to add all the possible devices

/data/ is not working for the phongap dev app :frowning:
/data/ (without slash is broken …)

ps must it /index.html or without slash (only working with leading slash on android)

You can just try set it to document.location.pathname.split(‘index.html’)[0]




works also great for ios phone / tablet. maybe we can make a cordova property which make this automaticlly. i think everyone need this with pushState + cordova!


Hello, thank God I have found this post coz I have been scratching my head all week on this.

Unfortunately, I can’t seem to get this to work. I do not think I quite follow you guys on where to add this line of code.


Where does it go? :confused:


It goes to pushStateRoot parameter under the view for which you have enabled pushState:

pushState: true,
pushStateRoot: document.location.pathname.split(‘index.html’)[0]
1 Like

Guys i will advise you to DISABLE push state in cordova apps! Why do you need it there? Only to be able to go back with hardware back button on Android devices only? There is more flexible solutions for this using backbutton event:

$(document).on('backbutton', function (e) {
  // for example, based on what and where view you have

I do not enable pushstate. Is it enabled by default?

Then you have some missconfiguration of routes

This is my route configuration:

var routes = [
path: ‘/’,
url: ‘./index.html’,
name: ‘home’,
path: ‘/question/:id/’,
componentUrl: ‘./pages/question.html’,
path: ‘/answer/:id/’,
componentUrl: ‘./pages/answer.html’,

More details, Cordova or web app? Platform iOS or Android? Any webview plugins like WKWebView? Any errors in developer console?

Its a cordova app. Working perfectly when I preview it in Chrome browser, but shows white screen after I build and test it on device. No errors in console.

Building for Android, only plugin is whitelist.

V2.0.6, Running on Cordova 8.0

Connect device to computer, open chrome://inspect/#devices in Chrome and check the issues/errors in console

Got it!!!

I actually had a syntax error on pageinit function of my home page that was messing everything up! I was not able to see it on the normal chrome console, until I inspected the device from Chrome as you suggested.

Thanks a lot for that!

All good now!

1 Like

how about multiple view(tab view) app, how to enable this back option there?

I resolved it by doing this, thank you :slight_smile:

if ( == ‘view1’) {
} else if ( == ‘view2’) {
} else if ( == ‘view3’) {

I’m using Framework 7 version 3 & React and getting the same issue. How can I resolve it when the route in React like:
path: ‘/’,
component: HomePage,

Please advise. Thanks.

Please ignore my issue. I got a solution. The root cause is the path to static files starting with “/static/” which incorrect when running under mobile app. For example, the result in android is file:///static/css/main.9f970902.css instead of file:///android_asset/www/static/css/main.9f970902.css

What I did to make it work as below:

  1. Run build command: npm run build
  2. Replace string “/static/” by “static/” in the build folder except css folder
  3. In css folder, replace string “/static/media” by “…/media”

I hope the Framework7 team will provide the fix for this issue in next release. Thanks.