We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fe5db15 commit 4a812e2Copy full SHA for 4a812e2
src/add-api.html
@@ -21,6 +21,27 @@
21
form.onsubmit = addApi;
22
function addApi(e) {
23
e.preventDefault();
24
+
25
+ try {
26
+ let up = new URL(form.url.value);
27
+ if (!up.pathname || up.pathname === '/') {
28
+ alert('Please specify a machine-readable API definition location, not a website root URL');
29
+ return(false);
30
+ }
31
+ if (up.pathname.endsWith('.html')) {
32
+ alert('Please specify a machine-readable API definition location, not an html page');
33
34
35
+ if ((up.hostname.indexOf('localhost')>=0) || (up.hostname.indexOf('127.0.0.1')>=0)) {
36
+ alert('Please specify a non-localhost URL');
37
38
39
40
+ catch (ex) {
41
+ alert(ex.message);
42
+ return false;
43
44
45
var details = {
46
format: form['spec-format'].value,
47
official: form.official.value,
0 commit comments