How do I display page from a particular point

Discussion in 'HTML & Website Design' started by it career, Sep 28, 2007.

  1. #1
    Is there any easy way to display from a starting point
    Like say,
    I use iframe but I do not want to display first 20% of the url.
    Has anybody faced this kind of problem before? How did you fix it ?
     
    it career, Sep 28, 2007 IP
  2. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #2
    you dont want to show the first 20% of the URL or the actual page?

    Are you just trying to disguise the URL to prevent people from looking at the source and seeing it is offsite content?
     
    AstarothSolutions, Sep 28, 2007 IP
  3. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #3
    No, first 20% is not required to be seen by user.
     
    it career, Sep 28, 2007 IP
  4. QiSoftware

    QiSoftware Well-Known Member

    Messages:
    805
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    158
    #4
    You may be able to crop an image. I do not think you are going to be able to crop a frame containing html. I will think about this some more.

    Q...
     
    QiSoftware, Sep 28, 2007 IP
  5. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You still havent clarified if it is the page you are trying to trim or the pages URL.

    One option is to screenscrape the page you are wanting into a string. Trim the parts you dont want off and then present this to the viewer. You will need to make sure any images or links are absolute rather than relative otherwise they will not work.
     
    AstarothSolutions, Sep 28, 2007 IP
  6. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #6
    Let me provide more clarifications
    Suppose domain.com has a page
    like
    
    <img> </img>
    <header> 
    content
    
    Code (markup):
    I want to do <iframe src="domain.com"> but only want to show the content not img or header.
     
    it career, Sep 28, 2007 IP
  7. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #7
    ok, so it is the page rather than the url you want to trim.

    I assume you dont control the other page's content and want to completely remove the other part of the document rather than just have it scrolled up. In which case screen scraping and removing the unwanted element would work but depending on how stable the point it is to start from is will dictate on how much effort it will require to maintain (eg if it is only the header you want to remove then it is easy, if it is a point in the middle of the document there is more risk involved)

    If there are links or images off the page you are loading then again there is more work to do.

    A very crude but workable version of just getting the content between the <body> tags is below. If you called the file "body.aspx" then your iframe would simpy be <iframe src="body.aspx" />

    
    <%@ Page Language="VB" %>
    <%@ Import Namespace="system.net" %>
    <%@ Import Namespace="system.io" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <script runat="server">
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim client As New WebClient
            Try
                Dim results As String = client.DownloadString("http://www.domain.com/")
                results = results.Substring(0, results.IndexOf("</body"))
                results = results.Substring(results.IndexOf("<body"), results.Length - results.IndexOf("<body"))
                results = results.Substring(results.IndexOf(">") + 1, results.Length - (results.IndexOf(">") + 1))
                outputLT.Text = results
            Catch wex As WebException
                'Something went awry in the HTTP request!
            Finally
                client.Dispose()
            End Try
        End Sub
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <asp:Literal ID="outputLT" runat="server" />
    </body>
    </html>
    Code (markup):
    To deal with links or images you can either make them absolute or add further screenscraping to hide the fact they are offsite
     
    AstarothSolutions, Sep 28, 2007 IP
  8. Mike H.

    Mike H. Peon

    Messages:
    219
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #8
    it career:

    Check your PMs.
     
    Mike H., Sep 28, 2007 IP
    it career likes this.