locked
viewing another site in my page RRS feed

  • Question

  • User436664564 posted

    hi

    i want to know if it is possible to have a part of another site for example part of yahoo in my page.

    it is kinda impossible i think;) but at least is it possible to resize the pop-out page to show the part i need ?

    for example someone select sth from a dropdownlist in my page and he sees information related to that part as i specify in yahoo (a new window with the size of 400*400 for example)


    thank you

    Thursday, September 3, 2009 12:26 PM

Answers

  • User190678028 posted

    Hi,

    You can do this with IFrames (inline frames). An <iframe> will allow you to pull in another URL into a portion of your page.

    Do a search for iframes and you should find evrything you need.


    Hope this helps,

    Shane

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 3, 2009 12:39 PM
  • User-590788913 posted

    Do some more digging and see if the section of the other web page has RSS feed. I think most popolar sites do that. The worst case is to parse out the HTML code. In both cases, you will need to get the CSS synced with the source.

    Using IFRAME cannot restrict which section of the target page to be displayed, although you can hack it through some XY scrolling position, it depends on Javascript and how often the target site changes layout also.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 3, 2009 12:39 PM
  • User-590788913 posted

    There is little trick to help you solve the XY offsets, you need to analyze the external site bit, and provide an anchor of the section of your interest. See my code below, pay special attention as '#today' and '#sw_content'.

    ASPX markup:

            <asp:DropDownList runat="server" ID="drpShowExternalPage" AutoPostBack="true">
                <asp:ListItem Text="Select a site" Value="" />
                <asp:ListItem Text="yahoo" Value="http://www.yahoo.com#today" />
                <asp:ListItem Text="bing" Value="http://www.bing.com#sw_content" />
            </asp:DropDownList>
            <hr/>
            <asp:Literal runat="server" ID="litIFrame" />


    C#:

            protected void Page_Load()
            {
                if (IsPostBack)
                {
                    if (!string.IsNullOrEmpty(drpShowExternalPage.SelectedValue))
                    {
                        renderIFrame(drpShowExternalPage.SelectedItem);
                    }
                }
            }
    
            private void renderIFrame(ListItem pair)
            {
                litIFrame.Text = "<iframe id='IFrameExternal' name='IFrameExternal' src='" + pair.Value + "' frameborder='1' scrolling='no' title='iframe for external site' style=";
                if (pair.Text == "bing")
                {
                    litIFrame.Text += "'width:656px;height:523px;'";
                }
                else if (pair.Text == "yahoo")
                {
                    litIFrame.Text += "'width:440px;height:271px;'";
                }
                litIFrame.Text += "/>";
            }


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 4, 2009 2:15 PM

All replies

  • User190678028 posted

    Hi,

    You can do this with IFrames (inline frames). An <iframe> will allow you to pull in another URL into a portion of your page.

    Do a search for iframes and you should find evrything you need.


    Hope this helps,

    Shane

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 3, 2009 12:39 PM
  • User-590788913 posted

    Do some more digging and see if the section of the other web page has RSS feed. I think most popolar sites do that. The worst case is to parse out the HTML code. In both cases, you will need to get the CSS synced with the source.

    Using IFRAME cannot restrict which section of the target page to be displayed, although you can hack it through some XY scrolling position, it depends on Javascript and how often the target site changes layout also.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 3, 2009 12:39 PM
  • User436664564 posted

    thanks a lot


    ok. i want to customize it through the c# code for example as the valueof a dropdownlist changes the <iframe> shows different urls with different height and width.

    i don't know how to import my iframe to the c# code. any help is appreciated

    Friday, September 4, 2009 11:01 AM
  • User-590788913 posted

    There is little trick to help you solve the XY offsets, you need to analyze the external site bit, and provide an anchor of the section of your interest. See my code below, pay special attention as '#today' and '#sw_content'.

    ASPX markup:

            <asp:DropDownList runat="server" ID="drpShowExternalPage" AutoPostBack="true">
                <asp:ListItem Text="Select a site" Value="" />
                <asp:ListItem Text="yahoo" Value="http://www.yahoo.com#today" />
                <asp:ListItem Text="bing" Value="http://www.bing.com#sw_content" />
            </asp:DropDownList>
            <hr/>
            <asp:Literal runat="server" ID="litIFrame" />


    C#:

            protected void Page_Load()
            {
                if (IsPostBack)
                {
                    if (!string.IsNullOrEmpty(drpShowExternalPage.SelectedValue))
                    {
                        renderIFrame(drpShowExternalPage.SelectedItem);
                    }
                }
            }
    
            private void renderIFrame(ListItem pair)
            {
                litIFrame.Text = "<iframe id='IFrameExternal' name='IFrameExternal' src='" + pair.Value + "' frameborder='1' scrolling='no' title='iframe for external site' style=";
                if (pair.Text == "bing")
                {
                    litIFrame.Text += "'width:656px;height:523px;'";
                }
                else if (pair.Text == "yahoo")
                {
                    litIFrame.Text += "'width:440px;height:271px;'";
                }
                litIFrame.Text += "/>";
            }


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 4, 2009 2:15 PM
  • User-1363023537 posted

    Hi,
     you can  look into their API and  see which functionality you would like to show in your page.
    you can use their api using HttpWebRequest , HttpWebResponse and render your part of page as
    per your requirement.

    Satalaj

    Thursday, September 10, 2009 10:37 AM