I am working on a content management project where from a tool we generate html/js/css
and image files. The data we store in JSON format.
Now, I want to play the contents using browser without any server, i checked some threads
and it suggests that it may be possible using file:// protocol, I want to check if there
is any limitation if I am not using any server. Or it is not possible to omit http server..
The other thing is that, I can't use concept of local storage because my data size is huge and in HTML5 the max size supported is 10 MB my requirement is approx 25 MB.
Please suggest.
Thanks.
Seems like an odd thing to do for a CMS, no? You can use the readfile API but you're limiting yourself to IE10+: http://caniuse.com/filereader
Edit, maybe should've been a comment but... If the data is only on clients computer, who can read the content of the CMS? Or are you creating 10MB+ files on every users computer?
Related
I am creating a server application to transfer many (could be 100+GB) files from discrete servers as a single tar archive to a browser client via a simple single file download.
Currently I settled on streaming in each file to the main server handling the web app's HTTP request, adding it to a dynamically created tar archive, and then streaming out the archive as it's created using chunked transfer encoding.
This works nicely but has 2 main downsides:
No download progress indicator for the browser client/user
Difficult to resume a failed/interrupted download
I'm looking for advice for either different techniques to implement this app or ways to address the shortcomings above. Some of the constraints are that since the archive is generated on the fly, the server doesn't know exactly how large the final result will be (it does have a rough idea since it is not compressed currently, it's just total(file_size + file_padding), maybe this could be determined?). And there is limited disk space available on the server along with limited memory on server & client so the download needs to occur in a streaming fashion; ie not storing it all in-memory or on-disk on server or client before writing it out to client's disk.
I've thought about implementing this by having the browser download chunks of known size and writing it out to a file as it goes, but it's not clear to me that this can be done with today's filesystem access limitations? And also without holding the entire archive in-memory on the client side. Aand also while presenting it as a single download to the user instead of n separate downloads. Kept running into hiccups like this so wanted to see what y'all think
Thanks for your help :)
We are working on Angular based application wherein we want to get the bandwidth of user's client machine to determine and show appropriate error message while displaying video streaming content on our app.
We have already looked into libraries like - ng-speed-test for the same however what it does is, it downloads a 5 MB file to determine the bandwidth.
In our use case we want to periodically check the bandwidth for that using this is not a suitable option.
Question In short we are looking for a way in JavaScript / Angular to know the bandwidth of user's machine without downloading a file and that should support in Google chrome, IE Edge (Chromium), Safari and Firefox.
Any suggestion that meets our case is highly appreciated.
You can't.
The only way to determine the speed of a network connection is to measure it.
The only way to do that is to transfer a known amount of data along it and time out long it takes.
This is Two questions:
1/ How can I read the cache stored by the browser if there's no permission restrictions?
2/ If the user browse into a website, is there a posibility of storing the page source code [HTML] in cache? (big website like youtube ..etc)
Thanks.
There is no way to read the cache manually - it all happens behind the scenes, if there is cache.
Yes, you can store the website's source code to the browser cache, but only the client-side part - HTML/CSS/JS/images/fonts/etc. It's called HTML5 Application Cache and it consists in a simple manifest file, which instructs the browser to download certain files locally and next time load them instead of downloading again. This cache you can programmatically update. Keep in mind, though, that most browsers have a limit (usually 5MB) of how much data you can store.
Hope that helps.
Which is the best way to store a pdf around ~4mb in sqlite with javascript?
I have tried using base 64 encoding but the Andoid browser freezes and quits when trying to open large files. Small files won't open either they just start to download but the download never completes and the filetype seems to be unknown. It has to work in the Android browser, and I have several files that I need to save so I have to use sqlite (because of size limits in offline storage)
Thanks in advance!
/Christian
You might want to consider PhoneGap for creating a Native application, thereby bypassing quotas. That way you can continue to use HTML5 to create the app.
This blog entry suggests a way to lift quota limits for PhoneGap apps:
http://blog.mattray.info/2011/08/into-blender-javascript-sqlite-ios-and.html
You could read the PDF in chunks (asking the server to send over bytes xx to yy), to minimize the impact on the mobile system, and store that in an sqlite table with a tracking number (chunk x of y) until you have everything. Then you could rebuild at any time the whole file as a big blob, and save that blob to a temp file -- see the link above for filesystem from html5rocks.
I have a web app (sencha/phonegap) that includes a feature allowing users to click on buttons that link to Wikipedia articles. This obviously works fine if the device has internet access, but I get numerous requests to make the app work when the app is offline too. To accomplish this, I'd like to give the user the option to download the linked articles/webpages for offline access. When the device does not have internet access, the app would instead display the saved version (which might be stale/out-of-date, but is better than nothing). What are possible ways to accomplish this task?
My first thought was to somehow use the html manifest to cache the pages in the phone's browser, which sounds possible on the Android browser, but iOS apparently has a 5MB browser cache limit - too small.
My next thought was to save the needed html & associated files and bundle them up inside the app. But this seems a rather cumbersome approach, the app becomes much larger than it needs to be, and the webpages are stale back to the date the app was installed.
Using javascript, is it possible to download webpages, which I could then save (on the sd card, for example) for access later?
Or is there a more elegant approach?
If anyone could point me in the right direction it would be much appreciated.
In pure Javascript you can make an Ajax request to download a page. Then you can use the FileWriter to write the responseText to a file on the file system. However, that won't help you when it comes to images. You'll need to use the FileTransfer.download() command to get the binary image files.
If I were you I'd:
Use AJAX to download the html.
Parse the html looking for images.
Use FileTransfer.download to get the images.