0

I have written a chrome extension in which I have a need to upload files. When somebody clicks on the upload button (which I made through <input type="file" />), it opens the select file dialog box as expected. Everything is good in Windows but when a user from macOS (with workspaces/multiple screen setup) opens it, it opens on a different screen.

My wild guess is that it happens because the extension loads on the top right corner of the browser and the select file dialog box which opens is going outside the current screen boundary, hence being shifted to another display/workspace.

Is there any way to control the select file dialog box and show it in the center of the screen?

Thank you :)

Naser Mohd Baig
  • 155
  • 1
  • 13
  • 1
    Not directly as there's no such API, but instead of using the built-in extension popup you can show the UI as an iframe in the page (you can find examples by googling for "web_accessible_resources iframe"). Visually you can make it look just like the popup. – wOxxOm Mar 20 '21 at 16:35
  • @wOxxOm, that's interesting. I will check it out. If that's done, then I believe dialog box would look the same irrespective of the OS's right? – Naser Mohd Baig Mar 20 '21 at 16:38
  • @wOxxOm, I tried googling web_accessible_resources iframe but couldn't find any relevant info (maybe there was one and I was dumb enough to let it pass). I'd really appreciate if you could paste some URLs here. – Naser Mohd Baig Mar 20 '21 at 17:09
  • 1
    Try [this one](https://stackoverflow.com/a/25100953/). – wOxxOm Mar 20 '21 at 17:16

0 Answers0