0

I want to have JavaScript to get a user's URL and return the source code of the website. I want to have this to essentially make an iframe, but with the actual code.

E.g. :

let userUrl = prompt("What website do you want displayed?","e.g. https://www.google.com");

function getSource(url){

//some code
return pageSource;
}
document.body.innerHtml=getSource(userUrl);

I tried to scrape a view page source website and turn it into an API that I could inject into JavaScript, but I had no luck.

jonrsharpe
  • 107,083
  • 22
  • 201
  • 376
yessir
  • 23
  • 6
  • Does this answer your question? [How to get html source code from external url](https://stackoverflow.com/questions/5289027/how-to-get-html-source-code-from-external-url) – Laurel Apr 05 '22 at 20:45

0 Answers0