mobile web app HTML and JavaScript file location - javascript

I'm new to mobile web app development. I have a simple fundamental question regarding mobile web app. Mobile web app is written in HTML and JavaScript. So are these HTML and JavaScript files stored on the mobile device locally or sent from a server? This question may be too simple for most people. But I ask this because if all JavaScript code is stored on mobile device, then how about cross domain access issues? Thanks.

It depends. If you package it in PhoneGap you will have all your assets stored in a single package that can be installed in multiple devices, but if you're working on a mobile web app thats served from a remote server, all the scripts, templates and css's will have to be downloaded. If you're having issues with cross domain comunications, try using JSONP in your requests.

All the files are downloaded each time you request certain url, for mobile devices and pcs as well.(the file will be downloaded or not depending on the caching setting, if the file was modified, etc)

Related

Possibility of running a local network server from the browser

This question is about the basic feasibility of this project but you are welcome to recommend ideas on how it could be done. I would like to create a hosted Java web application that creates a Server in the local network of the device.
For example: You can go to example.com in your Browser and start the application that creates a server in the local network of the device (Windows-PC). Other devices (Android) can connect to the server (UDP) with an installed Android-App.
Is this concept possible? I am afraid browser security renders this level of access impossible..
As others have pointed out it is not possible.
I will instead choose a local Java application that has to be installed.

Possible to remotely access files on mobile devices using HTML5/JS?

I have a file sharing web app online where I want people to be able to remotely access and upload files from their mobile devices without a client, but clientless via HTML5/JS, to our servers.
I have seem remote support companies log in to client devices just using browser with clients permission.
Thank you for your time
Robert
I have a file sharing web app online where I want people to be able to remotely access and upload files from their mobile devices without a client, but clientless via HTML5/JS, to our servers.
This isn't possible.
Web applications cannot access files that haven't been explicitly selected by the user. Additionally, they cannot store files on the user's system without a download, and they cannot do anything at all unless they are active in a browser -- they cannot run in the background.
Web applications running on mobile (i.e, Android or iOS) devices are even more limited. They typically cannot interact with most files on the system. For instance, web applications running on iOS can only upload photos from the user's photo library, not arbitrary files.
I have seem remote support companies log in to client devices just using browser with clients permission.
Either you were mistaken, or something else was going on. For instance, a client application may have been previously installed.
I'm not following exactly what you mean. If you already have the service, that means that you can just create a form with a filefield to upload whatever you want, the size limit is only imposed by your web server (apache/nginx/whatever) and your backend service.
You can complicate things a little bit using HTML5 web storage (that's what MEGA uses) but I can't give you any specifics if you don't explain a bit more in depth what you want to achieve.

Load local resources in Windows Hosted Web Apps (Project Westminster)

I'm currently packaging a website as a "Hosted Web App" for the Windows Store.
Is it possible to check if JavaScript, CSS and image files are already on the users devices inside the app package? This way a lot of traffic could be saved for files that don't change much after all.
Of course there would need to be a fallback to the hosted files in case the site is being called in a normal browser.
This is something that we're currently investigating and will be enabling more of in the future. Today you are able to access resources from the app package using the ms-appx-web:/// app protocol to load the resource. You can build this into your website code. We do have a security violation issue when your site is using https (as it definitely should) that we're working on resolving.

communication between web app and native android app

I have two different apps, one is a native android app and other is a web app built using sencha and javascript.
I need to get some information from the web app to my native app.
Any idea how this communication can be done ? I am not using any webview since both are two different apps.
Please let me know. I even tried cookies, local storage etc.. But seems to be the native android app cannot access the browser cookies or local storage..
Please help.
You can try the following:
Run an httpd at your app. If you use cordova, you can take a look at org.chromium.socket plugin. There is an example of how to set up a local http server:
https://github.com/MobileChromeApps/mobile-chrome-app-samples/blob/master/webServer/server.js
At your webapp you issue AJAX calls (replacing html with JSON would fit very well) to localhost, where your app is running at the background. Your app will respond the requests, using JSON for instance.
In the other way around, your app can make AJAX calls to the server, that can update your html/js app using websockets.
If you are not using cordova, it is even easier to build an httpd in Java:) just google around.

Web mobile application with offline mode

To begin, I'm sorry for my awful english :)
I have a web application that will communicate frequently with a server running a
webservice offering JSON / XML. The application will send contact details / bills / products, and will have to manage an offline mode.
I thought to use this DOM cache (HTML5). However I must have constantly an updated customer list, bills etc. in offline mode because I can not make a request to the server.
It is therefore necessary to have an xml file on the mobile ... which will be read and modified. Is it possible and not too difficult to manage XML plaintext database with ExtJS (or another framework) on a mobile? (Android)
Thanks.
It's far easier to do with HTML5 storage, which you can use directly without the need for Sencha Touch API calls (providing you're on a supported device, iOS Safari supports web storage).
Have a read of this article from the Sencha blog.
Have a look at Lawnchair - this can be included in your app without a framework.
If you decide to use Sencha Touch you can use localStorage, which allows you to store key/value pairs in the HTML5 Web Storage on the device.
See this tutorial on the Sencha website. You could use localStorage to cache your json feed whilst making static assets available offline with a cache manifest file.

Categories