-
Notifications
You must be signed in to change notification settings - Fork 2
/
demo.html
55 lines (50 loc) · 1.46 KB
/
demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!DOCTYPE html>
<html>
<head>
<title>WebDAV Navigator JS demo</title>
</head>
<body>
<form method="post" action="">
<fieldset>
<legend>Open Navigator</legend>
<dl>
<dt><label for="f_url">WebDAV URL</label></dt>
<dd><input type="url" id="f_url" required="required" /></dd>
<dt><label for="f_user">User login</label></dt>
<dd><input type="text" id="f_user" required="required" /></dd>
<dt><label for="f_password">User password</label></dt>
<dd><input type="password" id="f_password" required="required" /></dd>
<dd>Note: your credentials are not stored anywhere.</dd>
</dl>
<p><input type="submit" value="Connect" /></p>
</fieldset>
</form>
<!-- Uncomment to change language to French:
<script type="text/javascript" src="webdav.fr.js"></script>
-->
<script type="text/javascript" src="webdav.js"></script>
<script type="text/javascript">
var s = window.sessionStorage;
var url = document.getElementById('f_url');
var user = document.getElementById('f_user');
var password = document.getElementById('f_password');
if (s) {
url.value = s.getItem('url');
user.value = s.getItem('user');
}
document.forms[0].onsubmit = () => {
var _url = url.value.trim(), _user = user.value.trim();
s.setItem('url', _url);
s.setItem('user', _user);
try {
WebDAVNavigator(_url, {'user': _user, 'password': password.value.trim()});
}
catch (e) {
console.error(e);
alert(e);
}
return false;
};
</script>
</body>
</html>