dom111 / webdav-js

A simple WebDAV client written in JS for use as a bookmarklet, or integration into a web server.
MIT License
85 stars 17 forks source link

WIP Examples: header.html use raw html tags instead of bookmarklet #93

Closed stokito closed 1 year ago

stokito commented 2 years ago

And I didn't tested the header.html with Apache but I just put an index.html file into doc root and now it's shown fine when uses the bookmarklet loader. But when I used the plain html tags I got an error in console:

Uncaught TypeError: Invalid container element: 'null'.
    n https://cdn.jsdelivr.net/gh/dom111/webdav-js/src/webdav-min.js:1

I have no idea why it doesn't works. Could you investigate it? I also tried to use webdav.js instead of webdav-min.js but it doesn't works at all because has imports.

And I still don't get why the comment added in the end.

dom111 commented 2 years ago

Hey, apologies for the delay in getting back to you on this!

So the <!-- at the end is to comment out what Apache would normally have on the page so that the UI is entirely rendered by webdav-js, but it could be removed if needed.

Weird that you're seeing the errors... Do you see the problem when you run the Docker test (if you're able to?)

Also, what browser are you using?

stokito commented 2 years ago

I get it wat's a problem was: the javascript is loaded and executed before the html body rendered. So to fix that it should be enough to add a defer attribute or setup onload/onready hook. https://www.w3schools.com/tags/att_script_defer.asp#:~:text=The%20defer%20attribute%20is%20a,the%20page%20has%20finished%20parsing.

I don't have a time to check it but if you are interested please try.

dom111 commented 1 year ago

Merged as part of #109.

Also amended the build process to prevent these being overwritten.

Thank you!

stokito commented 1 year ago

Thank you @dom111 I'll test it latter