Rad
Rad

Reputation: 830

Javascript won't open filebrowser for Phonegap app correctly - but HTML does

I'm new to HTML/Javascript/Jquery, so this question may seem basic. But I've found a filebrowser online that I want to use in my app in Phonegap. The thing is, the example I've downloaded uses this method to open the filebrowser.

<a href="fileBrowser.html"  data-role="button" data-inline="true" id="browseBtn">Browse</a>

But I need to use the Javascript to open it, because I only want it when I longpress the button. But neither of these methods work:

window.location.href = ("fileBrowser.html");
window.open("fileBrowser.html");

Which I call like this (just to test if it works):

<a onclick="test()"  data-role="button" data-inline="true" id="browseBtn">Browse</a>

It is supposed to come out like this:

Working version from example

But unfortunately, it comes out as this, when I use Javascript: Nonworking, opened with javascript

Upvotes: 0

Views: 178

Answers (1)

wmfairuz
wmfairuz

Reputation: 1043

Looks like you use jQuery Mobile?

Use this:

$.mobile.changePage("fileBrowser.html");

Upvotes: 1

Related Questions