Click here to Skip to main content
13,196,946 members (57,864 online)
Rate this:
Please Sign up or sign in to vote.
See more:
hi all
i want to know how to display the content of any page from its url using javacript

Posted 17-Nov-12 23:22pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

very easy make a iframe
var ifrm  = document.createElement('iframe');
ifrm.setAttribute('src', 'anyurl');

[edit]var block to code block[/edit]
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

here you are the soultion works with me:
    public string GetHtmlFromUrl(string url)
        string html = "";
        HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();
        // get the response stream.
        //Stream responseStream = response.GetResponseStream();
        // use a stream reader that understands UTF8
        StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
        html = reader.ReadToEnd();
        // close the reader
        return html;//return conten html        

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171019.1 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100