I’ve recently updated my JS bookmarklet webdav-js and added in some new features including tracking the history state, back button support and proper navigation.
The main thinking behind the bookmarklet is to enable easy manipulationĀ of WebDAV shares without leaving the browser. This bookmarklet allows you to, at the click of the button, browse and upload to WebDAV shares, all within the browser. I’m working on copy/move functionality but currently it supports the basics.
It’s available on github and you can dragĀ the bookmarklet here directly to your bookmarks bar:
How it looks:
An additional item that might be of use to someone is being able to make your WebDAV shares use this automatically. If you have your server configured to allow directory listings when browsing WebDAV, you can use the directives to automatically send this bookmarklet contents to allow easy control of WebDAV shares without much configuration by adding the below to your Apache config files:
... Options +Indexes HeaderName /webdav-js.html ...
and saving the below as webdav-js.html
in the root of your WebDAV share:
<script type="text/javascript">javascript:!function(){var t=document.getElementsByTagName("head")[0],e=function(e,s){var a=document.createElement("script");a.src=e,a.type="text/javascript",s&&(a.onload=s),t.appendChild(a)},s=function(e){var s=document.createElement("link");s.href=e,s.rel="stylesheet",t.appendChild(s)};e("https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js",function(){["https://cdn.rawgit.com/noelboss/featherlight/1.7.1/release/featherlight.min.js","https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?autorun=false","https://cdn.rawgit.com/notifyjs/notifyjs/master/dist/notify.js","https://cdn.rawgit.com/noelboss/featherlight/1.7.1/release/featherlight.min.css","https://cdn.rawgit.com/dom111/webdav-js/master/assets/css/style-min.css","https://cdn.rawgit.com/dom111/webdav-js/master/src/webdav-min.js"].forEach(function(t){t.match(/css$/)?s(t):e(t)})})}()</script>
I do intend to add support for more functionality as time allows.
Tested in Chrome and Firefox.
When I run the bookmarklet on Chrome, I get :
Uncaught DOMException: Failed to execute ‘open’ on ‘XMLHttpRequest’: Invalid URL
at y (https://cdn.rawgit.com/dom111/webdav-js/master/src/webdav-min.js:17:158)
D’oh! Looks like I had the wrong style path in there, I’ve updated that on the page and I’ll update the repo ASAP. Thanks for flagging!
i got some trouble with uploading any non text based file types like jpg,pdf,docx… As mentioned text file based file types like php, html, txt, md… works without trouble. When I download the uploaded jpg for example and open it with a image viewer i got this message: (Not a JPEG file: starts with 0xc3 0xbf) and when i open a pdf sometimes he shows me only blank pages, sometimes it shows an error message
you have any how i can solve it?
Thanks for flagging Niel! I’ve raised an issue to track this on GitHub: https://github.com/dom111/webdav-js/issues/17.
I’ll try and notify you directly if I don’t see you subscribe to the issue!
Edit: This has been fixed, please could you check out the latest version?