I am developing an app with html5 pages locally stored in the assets folder. I have included a database with some php scripts, is it still possible to run in WebView?
for using database in webView you have two ways:
1) use localStorage that you should handle it by javaScript
2) use java database,for that you need javaScriptInterFace() that provide you a bridge between javaScript and java class. and create java database then put your data in it or read from it
see this link it will help you-(this link show you how use java database like browser localStorage)
No not at all you can not run a php in a webview it can understand only html ,CSS and JavaScript just like a browser.
Suggestion 1:
If you want to build a HTML page using your local database you could do that using java no need of php.
Just fetch the data from db then build HTML page by concatenating java strings with the data,HTML mark up,CSS and javascript then load the resulting HTML page in webview
If you want to access Java function from JavaScript you could use addjavascriptinterface of java.
The java function can be anything like a function that inserts or updates data into local dB or a function that returns a data from local db
It can also produce dynamic html content locally jus like a dynamic web language like php,classic asp etc..
Suggestion 2:
If you want to do it using php then you have to host it in the internet server along with db and load the page URL in webview
Related
Has anyone had success embedding a Heroku PostgreSQL dataclip within an external webpage?
I've tried embedding via an iframe, but I keep running into cross-domain errors.
I see that a CSV can be imported into Google Sheets, which can then be imported into my site. But ideally I'd like to embed the dataclip page directly, along with all functionality - exporting, versions, query preview, etc.
Thanks for your help!
Is it possible using the Dropbox JS SDK to create a JavaScript web application that is able to parse the files in a user's Dropbox? In my use case, the user has some JSON files that I would like to parse and preview in the browser. Will the filesDownload(arg) method allow for this type of application, or is it only able to download the file to the user's machine?
The download methods, such as filesDownload and sharingGetSharedLinkFile return the file content directly as a Blob, as seen in the download example.
As long as you can use a Blob to do what you want, this should be possible.
If an webapp I am running did a GET on a javascript file but I wanted to intercept that GET and provide a different javascript file could I do that?
What would be the easiest method?
To give a frame of a reference I am writing a meteor application and the server database got torched. My only hope seems to be to take a cached version of the application.js and inject it because I believe mostly everything can be rebuilt from that.
You can edit the existing JavaScript code.
Not sure how to replace the JavaScript file.
Press F12 it bring the developer tools at bottom of your page .
Go to resource and select your JavaScript file
It will open inside editor(right side) there you can modify your script.
Greetings,
I'm looking for a way to launch a GWT module when a user clicks on an XML file and have the module consume the xml data. Ideally I would like to render the XML in a rich manner and would prefer to use GWT controls instead of having to lay it out by hand via xslt + javascript.
I'm supposing one way would be to point the xml to a well known xslt that creates a simple html page that forces a redirect to the gwt module but how would I transfer the xml data to said module to allow for enhanced formatting?
Another way would be to have the process that produces the xml also include the bootstrap gwt module but it would be creating multiple bootstrap instances over time and pollute the user's directory.
The use case is that a user would run this app on their local machine which outputs an XML file. If they try and view the xml file in a browser, I'd like to have the GWT module take over and present the data accordingly. I would rather they not have to go to a page and upload the data manually.
Appreciate any ideas on the matter.
TIA
If it's something that runs on the user's machine, I would recommend to ship an executable, or generate a parallel HTML file to present the data. JavaScript run from file:/// will not be able to acces the filesystem.
If there's a way for the client side GWT code to pre-process a file on the client computer?
For example, to calculate a checksum of it before submitting the file to the server.
No it is not possible. The manipulation of the file is done by the browser, not the HTML code.
Think about it, GWT is 100% javascript. And javascript has no access whatsoever of the file in your computer. That would be an pretty big security risk! GWT "wraps" the file input box so it can be displayed inside the GWT panel. But once you press the "upload" button, the upload is done by the browser.
You could do file manipulation with another technology however. Java applets for example. But that is outside of GWT area...
Using GWT, there is no way to read files on the client side yet. However, in HTML5, you can read files without uploading to a server using the "File API".
Links are provided below.
File API tutorial on html5rocks.com
Example of how to use File API in GWT via JSNI
I'm pretty sure that because GWT code compiles to pure JavaScript, there isn't a way without requiring some third-party browser plugin.
Do you mean from an <input type="file"...> file upload field in a form?
The short answer is no-- file uploads are handled by the browser, and are sent directly to the server (as an ENCODING_MULTIPART POST). And security restrictions on JavaScript mean there's no way to workaround that restriction.