我有一张图片的链接。图像托管在服务器中。现在单击按钮或单击图像,我想使用 native 应用程序打开该图像。就像在 android 图像查看器或 iOS 图像查看器中,这样我就可以放大或缩小等。
<a href="http://www.example.com/potenga3.jpg" class="" title="Potenga 3">
<img src="img/thumb/potenga3_t.jpg" alt="image" class="one_third">
</a>
我试过了。
<a href="#" onclick="window.open('file:///path_to_image', '_system', ' ');">Image</a>
没用。什么是简单的方法来做到这一点。如果 ios 和 android 操作系统不存在通用解决方案,您现在可以建议我只针对 android。
最佳答案
我需要使用 android 的 native 代码
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(fileURI), "image/jpeg");
startActivity(intent);
关于android - 如何使用手机的 native 应用程序打开图像 - Cordova/phonegap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22680711/