最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - HTML5 Select photos directly from Photo Library on Safari iOS - Stack Overflow

programmeradmin11浏览0评论

Is there any way to directly open the Photo Library and select photos when clicking on HTML file control on Safari iOS/WebViewController?

I was able to directly open camera and documents (only on iOS 14 devices) from the file control using the following codes.

To open the camera:

<input type="file" name="media_file" accept="image/*, video/*" capture="environment">

And to open the documents:

<input type="file" name="media_file" accept="application/pdf" >

But couldn't open the Photo Library. Instead it is showing the following menu and from there I have to open the Photo Library to chose photos. But I need to open the Photo Library directly without showing the menu. Is it possible?

Is there any way to directly open the Photo Library and select photos when clicking on HTML file control on Safari iOS/WebViewController?

I was able to directly open camera and documents (only on iOS 14 devices) from the file control using the following codes.

To open the camera:

<input type="file" name="media_file" accept="image/*, video/*" capture="environment">

And to open the documents:

<input type="file" name="media_file" accept="application/pdf" >

But couldn't open the Photo Library. Instead it is showing the following menu and from there I have to open the Photo Library to chose photos. But I need to open the Photo Library directly without showing the menu. Is it possible?

Share Improve this question asked Oct 21, 2020 at 7:43 Dipu RajDipu Raj 1,8944 gold badges33 silver badges39 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 1

There isn't a direct way through HTML or JavaScript to force the Photo Library to open directly without presenting the initial choice menu.

Frameworks like Cordova or Capacitor might offer plugins or APIs that allow deeper integration with iOS features. Refer to this Capacitor Camera plugin here.

There is no direct way to bypass the options menu and open the Photo Library directly from an HTML file input. This is a limitation of the browser and operating system's handling of file inputs for security and user experience reasons.

No, it is not possible to bypass the menu and directly open the Photo Library on Safari iOS when clicking an HTML file input control. The menu is a security feature designed by iOS to give users control over their file selection.

发布评论

评论列表(0)

  1. 暂无评论