On www.example.com/page_a/ is it possible to run a javascript code that searches for the text "hello" inside the file located at www.example.com/page_b/my_file.txt ?
Is this possible with javascript/jquery/ any other javascript framework?
Yes, it is possible and it is simplest with jquery.
You need to "get" contents of the text file like this:
$.get("www.example.com/page_b/my_file.txt", function(contents){
//contents variable now contains the contents of the textfile as string
//check if file contains the word Hello
var hasString = contents.includes("Hello");
//outputs true if contained, else false
console.log(hasString);
})
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments