I am making a widget for mobile and I want to save some xml files and image files for my widget but when I 开发者_运维技巧tested this code in opera widget Mobile emulator for windows, I didn't get any response.
function storage () {
var mountpoint=opera.io.filesystem.mountSystemDirectory('storage','myCoolSaves');
alert('he he he '); //// It was just to check if it executes first line on not but it doesn't
var file = myCoolSaves.createDirectory('/myImages');
var stream = file.open('newfile.txt', opera.io.filemode.WRITE);
stream.writeLine('hello');
stream.close();
stream = file.open('newfile.txt');
var data = stream.readLine();
stream.close();
opera.postError(data);
}
But if i put alert in start of the function it shows which means that the function's being called but the code is not working. Do I need to import some libraries?? include opera sdk?? can any one help me please
Opera Mobile Widgets don't have support for the File I/O API (which was announced on http://labs.opera.com/news/2008/05/08/). File I/O is only supported on desktop builds.
This explains why your code isn't working on mobile.
精彩评论