Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

How can I read a website's html code into a javascript string on my computer?

I have an html file on my local computer with javascript code inside it. I would like to have my javascript do some processing on information retrieved from a different web page (i.e. a page that's read in from out on the internet).

I have tried creating a frame on my page that links to the other site and accessing that frame's .innerHTML but that triggers a privilege violation error. I've tried using XMLHttpRequest, but that never comes back with a successful status (getting 0 instead of 200 or 304). I have tried using an iframe and reading its innerHTML, but when I do that I only get the html code that's used if the browser doesn't support iframes.

Does anyone know a way to do this? Is there a way I can set the privilege with Firefox to allow it to get the other frame's html code?

Update:

Firebug looks like a nifty tool. But does it add some capabilities that let me override the privilege violation thing? or will it get the XMLhttpRequest to work?

3 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    To read the content of a web page from cross domain sites the page needs to be privileged. Local HTML files are unprivileged. Some solutions are:

    - Develop an extension, which gives HTML files inside it privileged.

    - Use a platform targeted at creating these kind of applications, e.g. xulrunner or Adobe Air.

  • 1 decade ago

    Easy, Download firefox addon "Firebug" :)

  • 1 decade ago

    Please choose my choice go to http://www.wapka.com/ and login there and enter and go to tools option and now there are option 'web source' press ok and input a web address you want and you have the source of this website.the path is =wapka.com>login>tools>web source

Still have questions? Get your answers by asking now.