-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshorten-url.js
More file actions
20 lines (16 loc) · 920 Bytes
/
shorten-url.js
File metadata and controls
20 lines (16 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// copy this 👇 without // and add it as a bookmark
//javascript:fetch("https://rel.ink/api/links/", {headers: { "accept": "application/json, text/plain, */*", "content-type": "application/json; charset=UTF-8" },body: JSON.stringify({ url: window.location.href }),method: "POST",}).then((resp) => resp.json()).then((data) => navigator.clipboard.writeText(`https://rel.ink/${data.hashid}`).then(() => alert(`copied https://rel.ink/${data.hashid}`)).catch(err => alert(err)));
fetch("https://rel.ink/api/links/", {
headers: {
"accept": "application/json, text/plain, */*",
"content-type": "application/json; charset=UTF-8"
},
body: JSON.stringify({
url: window.location.href
}),method: "POST",})
.then((resp) => resp.json())
.then((data) => {
navigator.clipboard.writeText(`https://rel.ink/${data.hashid}`)
.then(() => alert(`copied https://rel.ink/${data.hashid}`))
.catch((err) => alert(err))
});