Nomally web browser would not allow a website to access the users local files. I came across locallinks plugin which allows the file:/// access from a webpage , however such file opens up in a different tab.
I wanted to create a player which already has information about the file location on a clients computers and would play the media file on being clicked.I have coded something like this
<audio controls="" id="player">
<source src="file:///home/vihaan/Music/001) Led Zeppelin - Stairway to Heaven.mp3" type="audio/mp3"/>
Your browser does not support html 5 audio
</audio>
I had assumed that installing that plugin would make this work ! I have also heard about NPAPI plugins. Would it be possible to create a plugin which after the webpage gets loaded allows reading a file into the webpage i.e playmusic from a users computer without the user actually have to select the folder every time. Thanks
It would absolutely be possible to do this with an NPAPI plugin; it would most likely be a very, very bad idea.
There is a reason that browsers have those security restrictions in place; if you allow your web page to read arbitrary data on a user's computer then suddenly any other website could just use your same plugin to do the same thing; and they might not be just reading music. Bare minimum you'd need some very careful restrictions on it, and even then you'd likely open up a security hole that you aren't aware of by accident. You don't want to be known as the creator of the plugin that allowed the next botnet to take over.