Link to home
Start Free TrialLog in
Avatar of evc134
evc134Flag for Belgium

asked on

How to read/write files with Opera Mobile on Windows Mobile 6.1 using javascript

Hello !

I am trying to write a file from a HTML page using javascript in my offline application. I use Opera Mobile on a Windows Mobile 6.1 OS.
I do not find any working solution at the moment...

The best attempt so far was to use the following procedure :

http://jquery.tiddlywiki.org/twFile.html

It uses JQuery and a small library implementing a "save" and a "load" function. It has to call a jar file in order to work with Opera.
My very simple script works on my computer, using a "normal" Opera, but the "save" and "load" functions do not work anymore on the mobile device. I also tried on my computer with an Opera Mobile emulator, it did not work neither.

Here is a the main part of my code. It succeeds on Opera, but not on Opera Mobile (emulator and mobile device).
Other JQuery queries are working properly on the mobile.

<script>
// Run on document load
		
jQuery(function() {
	var $ = jQuery; // local alias
	var loc = location.pathname;
	var filepath = loc.substr(0,loc.lastIndexOf('/') + 1) + 'test.txt';

	var text = $.twFile.load(filepath); // Load the file
			
	if(text){
		alert('success');
	}
	else{
		alert('failed');
	}
			
	$('#validate').click(function(){
				
	        $.twFile.save(filepath, $('#name').attr('value'));
	});
			
});
	
</script>

Open in new window


Any idea ? Of course, any other method allowing to read/write files would be good too.

Thank you,

B.D.
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Have you considered using window.localStore instead?
https://developer.mozilla.org/en/DOM/Storage#localStorage
ASKER CERTIFIED SOLUTION
Avatar of evc134
evc134
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of evc134

ASKER

right we write a standard c# application instead