Jump to content

Concerning the use of (i)frames


Jonas

Recommended Posts

Isn't it possible to use an <object> tag to display an external page instead of the ugly iframe solution, also requiring target attributes. If this is possible, you can use javascript links, giving your <object> tag an id, and in your javascript links use document.getElementById('id_name').data="" Would that be possible, combined with a type="text/html" in the object tag? I got the idea from looking here:http://www.w3schools.com/tags/tag_object.asp

Link to comment
Share on other sites

I have never tried that...infact had never thought of it, but I don't think that will work. There is no src attribute. How would you link the external page to the <object>???The javascript might work but you would have to open the external page and read the content with javascript then dump it int the object.Sounds like a lot of work and processing to avoid an iframe. You can hide the borders of the iframe so it ins't noticable until it overflows the set area.I do this sometimes on purpose <div style="width:300px;height:300px;overflow:auto">...Loads of text...</div>If you hate iframes that much you could just use ASP or PHP and then use SSI. This provides complete seamless entry of external pages that take the space they need, no scroll bars or borders.

Link to comment
Share on other sites

I'm not talking of putting blocks of code into the object, but entire html documents like you would with an iframe. I've tried it with an xml file with styling, and that worked, so in theory a html file should work. You don't use src, you use data.<object data="file_name.html" type="text/html" id="id_name"></object><a href="#" onclick="document.getElementById('id_name').data="file_name_2.html"I guess the question is really if you can access the object file like this, if data is a part of HTML DOM. Is there something wrong with doing it like this?

Link to comment
Share on other sites

Should be fine. Just make sure that the link brings you to the right page anyway if the user has JavaScript turned off using return false.

<script type="text/javascript">	function changePage(page) {		document.getElementsByTagName('object')[0].data = page;		return false;	}</script>...<p><a href="page.htm" onclick="return changePage('page.htm')" onkeypress="return changePage('page.htm')">Change page</a></p>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...