get filename from url js
var filename = location.pathname.substr(location.pathname.lastIndexOf("/")+1);
get filename from url js
var filename = location.pathname.substr(location.pathname.lastIndexOf("/")+1);
javascript get filename from url
var filename = url.split('/').pop();
js get file content from url
// create a variable called content containing the content from https://URL/file
fetch("https://URL/file").then((r)=>{r.text().then((d)=>{let CONTENT = d})})
javascript read file from url
// read text from URL location
function getText(){
var request = new XMLHttpRequest();
request.open('GET', 'http://www.xxxxx.com/pocket.txt', true);
request.send(null);
request.onreadystatechange = function () {
if (request.readyState === 4 && request.status === 200) {
var type = request.getResponseHeader('Content-Type');
if (type.indexOf("text") !== 1) {
return request.responseText;
}
}
}
}
create file object from url typescript
fetch('//my-image-url')
.then((e) => {
return e.blob()
})
.then((blob) => {
let b: any = blob
b.lastModifiedDate = new Date()
b.name = ''
return b as File
})
// Promise returning a File Object
// (usefull for previewing image in updating forms)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us