Click here to Skip to main content
16,013,648 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi all
i want to know how to display the content of any page from its url using javacript

thanks
Posted

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


[edit]var block to code block[/edit]
 
Share this answer
 
v2
here you are the soultion works with me:
C#
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
    reader.Close();
    response.Close();
    return html;//return conten html
}
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900