I am developing a single page application using Vanilla Js. My code contains a function which utilizes fetch
using a proxy
to get data from a site. But, the problem is that after I open the single page application (index.html
file) and come back to it later it redirects to the website with the url specified in fetch
. For example, if this is my Js function
...
function getData() {
fetch('https://young-waters-99383.herokuapp.com/https://example.com/thisFile.md')
.then(response => response.blob())
.then(blob => blob.text())
.then(data => {
let myDiv = document.querySelector('#myDiv');
myDiv.innerHTML = data;
}
}
...
then the website now goes to https://example.com/thisFile.md
after I leave it open and return to it after some time. What could be the problem?