Jump to content
xisto Community
Sign in to follow this  
iGuest

Getting HTML source code of a remote page.

Recommended Posts

Hi there,I'm trying to get the source code of a page hosted on another domain using JS. I've tried a couple of methods but nothing seems to work with pages located on a remote host. I know this could be easily done using a server-side script, but my question is: it is possible to do it with JS?Thanks in advance.

Share this post


Link to post
Share on other sites

You mean read it in to a variable? You can, but it will only work in IE. Mozilla's too secure. You have to use the Javascript XML HTTP Request object. Search Google for it.

Share this post


Link to post
Share on other sites

Yep, that's exactly what I mean. I've tried the XML http object but as you pointed out, it works only in IE. So I have to conclude that it's not possible to do it with cross-browser support. Thank you.

Share this post


Link to post
Share on other sites

Google "javascript file_get_contents equivalent"

/archives/

That site would come in great use, he has tutorials for nearly every single php function that was converted to javascript :D
Very useful

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.