Avatar of evc134
evc134
Flag 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.
SmartphonesWindows OSWeb Browsers

Avatar of undefined
Last Comment
evc134

8/22/2022 - Mon
Michel Plungjan

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

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
evc134

ASKER
right we write a standard c# application instead
Your help has saved me hundreds of hours of internet surfing.
fblack61