使用 Opera 小部件模拟器在 Opera 小部件中出现文件 I/O 问题

发布于 2024-10-21 14:57:25 字数 668 浏览 4 评论 0原文

我正在为移动设备制作一个小部件,我想为我的小部件保存一些 xml 文件和图像文件,但是当我在用于 Windows 的 Opera 小部件移动模拟器中测试此代码时,我没有得到任何响应。

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);
}

但是,如果我将警报放在函数的开头,它会显示这意味着该函数正在被调用,但代码不起作用。我需要导入一些库吗?包括opera sdk??谁能帮帮我吗

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

会傲 2024-10-28 14:57:26

Opera Mobile Widgets 不支持文件 I/O API(已在 上宣布) http://labs.opera.com/news/2008/05/08/)。文件 I/O 仅在桌面版本上受支持。

这解释了为什么您的代码无法在移动设备上运行。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文