phonegap-ratchet-demo icon indicating copy to clipboard operation
phonegap-ratchet-demo copied to clipboard

push call not working from javascript

Open Marvin256 opened this issue 9 years ago • 1 comments

Thank you for the patch but I have an issue : If you call the push method from your javascript like this :

PUSH({url: 'theme1.php', transition: 'slide-out'});

the transition to the new content doesn't work. I could see in phonegap debuger that the page is called but it doesn't apear.

It is of course working outside phonegap (on an apache web server for example)

Do you see what is going on with this one?

Marvin256 avatar Feb 10 '16 11:02 Marvin256

Found that the issue is related with Phonegap that doesn't transform the url argument into something like file:///var/mobile/Containers/Bundle/Application/APP_NAME/UUID/www/theme1.html

I could workaround by getting the root path of my app (set this into the deviceraedy event) :

var documentsDirectoryPath = decodeURIComponent(window.location.href);
appRoot = documentsDirectoryPath.substring(0, documentsDirectoryPath.indexOf("index.html"));

Then the push call should look like this:

PUSH({url: appRoot + 'theme1.php', transition: 'slide-out'});

Marvin256 avatar Feb 11 '16 14:02 Marvin256