firefox操作系统中的图像选择器

时间:2013-10-14 16:34:38

标签: javascript html5 firefox firefox-os

我是Firefox OS应用程序开发的新手..

我正在尝试创建简单的图像查看器,并编写以下HTML代码

  <html>
<head>
<title>Image App</title>
<link href="sty.css" rel="stylesheet" type="text/css">
<script>


function wind()
{
var selected_file = document.getElementById('input').files[0];
alert(window.URL+"\\"+selected_file.name);

var img = document.createElement("img");
img.src = window.URL.createObjectURL(selected_file);
}
</script>
</head>
<body>
Welcome To Image APP

<input type="file" id="input" onchange="wind()">

</body>
</html>

但它不会加载图像文件。请告诉文件api和firefox os可用的函数

1 个答案:

答案 0 :(得分:0)

AFAIK file - 类型输入目前未在B2G(Firefox OS)中实现,您应该使用Web Activities来执行此类任务。

如果您只对图片感兴趣,则应使用pick网络活动 - 有关详细信息,请参阅How to use images from the device in Firefox OS中的答案。

如果要访问存储并可能读取任何其他文件类型,则需要Device Storage。请注意,您的应用程序需要至少在Firefox Marketplace上请求Privileged权限。