I have a program (Mendeley) that tries to open PDF
files that are stored locally by accessing the URL: http://path.to/file.pdf
(instead of file://path.to/file.pdf
). This results in an error in my browser (not unexpected).
What I would like to do is have a javascript bookmarklet
that uses the URL in the address bar (which is basically correct besides the http part) and opens the file in an external viewer (Acrobat in my case). My latest creation (inspired by other examples on SO has been):
javascript:var a = (location.pathname);
var b = ('file://schbs02'+a);
window.location = (b);`
This does NOT work; in Chrome (latest version) nothing happens. Is it an inherent limitation of bookmarklets (for security purposes) that they can not open local files or is there something wrong with the code?