SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: <Object> embedding questions

  1. #1
    SitePoint Member
    Join Date
    Nov 2007
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    <Object> embedding questions

    I want to use the <object> parameter to embed a existing html page within another web page.

    Example:

    <object data="http://www.URL-GOES-HERE.com" type="text/html" width="200" height="200" style="overflow:hidden; width: 200px; height: 200px"></object>

    My question,

    I want to change the viewable position of the embedded web page that is displayed inside the object box. I do not want to change the actual position of the box itself - like align left / right / center. )

    For example, if i embedded a html page that displayed the word "HELP" with the <object> code - how would I make the object code display only half of the html page showing just the letters "LP".

  2. #2
    Robert Wellock silver trophybronze trophy
    SitePoint Award Recipient xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,242
    Mentioned
    51 Post(s)
    Tagged
    0 Thread(s)
    You probably cannot as it is a replaced element and an 'embedded object', which is also a fully independent page. Well, it if you could, it would probably need JS. Perhaps instead using server-side includes or something would have been an easier solution to pull the relevant data into the page itself rather than try a full file.
    };-) http://www.xhtmlcoder.com/
    Thinking Web: Voices of the Community

    > March 2013 - SitePoint forums: Spot the Error 3: Calling all Sleuths! Winner Announced!... She knows how to spot simple <code> errors but do you?

  3. #3
    Mouse catcher silver trophy
    SitePoint Award Recipient Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,101
    Mentioned
    66 Post(s)
    Tagged
    1 Thread(s)
    Hmmm .... not sure of an easy way to make it show the middle/right side of the page. You can move it vertically by using a #fragment reference to an ID/name part way down the page, and that works absolutely fine.

    You can use the same kind of #fragment reference to get it to shift horizontally, but you'll need to be careful about how you set it up if you want to ensure it cuts off at the correct point. For example, in the parent page, I have
    HTML Code:
    <object height="50" width="200" data="test2.htm#jump"></object>
    and in the included page I have
    HTML Code:
    <p style="width:500px;">Here is a very long paragraph. This is some <span id="jump">text that starts</span> in the middle of the page</p>
    you can see the result here:
    object-shift.png
    In other words, it scrolls far enough right to contain the referenced fragment (the <span> in this case), unless the referenced fragment is wider than the <object> element in which case the start of the fragment appears at the left edge.
    Any posts I write in Arial are on my mobile phone, so please excuse typos etc.
    Any posts I write in Verdana are on a PC, so feel free to berate me mercilessly for any mistakes


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •