Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-14-2013, 05:35 AM   PM User | #1
hsteiger
New to the CF scene

 
Join Date: Aug 2012
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
hsteiger is an unknown quantity at this point
HTML code only works in Firefox & Opera

Challenge to anyone interested (please forgive the long explanation):

The code below is supposed to display looping images from 4 radar sites. Note that each site is centered within its own iframe.

I assigned each image as a background to its respective iframe. Since each image is larger than the iframe that contains it, this allows me to center the image on each radar location within the smaller iframe.

Now the problem! This code only works like it should (i.e. displaying looping images in each iframe) in the Firefox and Opera browsers. It won't work at all in IE. In Google Chrome, it only works correctly in the upper left iframe, and has trouble even loading the images in the other iframes. And in the Safari browser, although it is able to display all the radar images, it seems that only the upper left iframe loops consistently.

Note that I have only worked with HTML 4.01, and I am hoping SOMEONE can figure out what I need to do to get this code to work correctly in IE, Google Chrome, and Safari browsers. I did run it through a CSE HTML Validator and it looked OK.

Thanks much. Henry
____________________________________________________________

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta http-equiv="refresh" content="120">
</head>

<body>

<table width="940" border="0" cellpadding="0" cellspacing="0">
<caption align="center">Ft. Campbell, KY upper left, Old Hickory, TN upper right, Memphis, TN lower left, and Hytop,
AL lower right)</caption>
<tr>
<td>
<iframe width="466" height="386" align="left"
style="background-image:url('http://radar.weather.gov/ridge/lite/N0R/HPX_loop.gif');
background-repeat:no-repeat;
background-attachment:fixed;
background-position:-56px -57px;">
</iframe>

<iframe width="466" height="386" align="right"
style="background-image:url('http://radar.weather.gov/ridge/lite/N0R/OHX_loop.gif');
background-repeat:no-repeat;
background-attachment:fixed;
background-position:410px -50px;">
</iframe>
</td>
</tr>

<tr>
<td>
<iframe width="466" height="386" align="left"
style="background-image:url('http://radar.weather.gov/ridge/lite/N0R/NQA_loop.gif');
background-repeat:no-repeat;
background-attachment:fixed;
background-position:-56px 335px;">
</iframe>

<iframe width="466" height="386" align="right"
style="background-image:url('http://radar.weather.gov/ridge/lite/N0R/HTX_loop.gif');
background-repeat:no-repeat;
background-attachment:fixed;
background-position:412px 335px;">
</iframe>
</td>
</tr>
</table>
</body>
</html>
hsteiger is offline   Reply With Quote
Old 03-14-2013, 09:18 AM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,455
Thanks: 0
Thanked 498 Times in 490 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
You should be using div or img tags - not iframe to attach those images (div if they are irrelevant to the page and are just background decoration behind content and img if they are supposed to be part of the page content. Anyway as background it makes no difference whether the browser displays them or not.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 03-15-2013, 10:02 AM   PM User | #3
Arbitrator
Senior Coder

 
Arbitrator's Avatar
 
Join Date: Mar 2006
Location: Splendora, Texas, United States of America
Posts: 2,900
Thanks: 5
Thanked 188 Times in 185 Posts
Arbitrator is on a distinguished road
Quote:
Originally Posted by hsteiger View Post
I assigned each image as a background to its respective iframe. Since each image is larger than the iframe that contains it, this allows me to center the image on each radar location within the smaller iframe.
This is not proper use of an iframe element, which is supposed to be used to display content external to the current document.

Quote:
Originally Posted by hsteiger View Post
Now the problem! This code only works like it should (i.e. displaying looping images in each iframe) in the Firefox and Opera browsers. It won't work at all in IE. In Google Chrome, it only works correctly in the upper left iframe, and has trouble even loading the images in the other iframes. And in the Safari browser, although it is able to display all the radar images, it seems that only the upper left iframe loops consistently.
Your code works for me in Firefox 19, Opera 12.1, and WIE10 out of the box. I have to use a Maximize or Restore Down command to get the images to display properly in Chrome 26; otherwise, your code works in that browser as well. I'm on a Windows machine, so I can't check your code in Safari.

Quote:
Originally Posted by hsteiger View Post
Note that I have only worked with HTML 4.01, and I am hoping SOMEONE can figure out what I need to do to get this code to work correctly in IE, Google Chrome, and Safari browsers. I did run it through a CSE HTML Validator and it looked OK.
I was able to get a properly coded HTML5 solution working with a bit of trouble. It works in all of the aforementioned browsers, but probably not so much in older browsers:

Code:
<!doctype html>
<html lang="en-US">
	<head>
		<title>Demo Document</title>
		<!-- <base href="http://radar.weather.gov/ridge/lite/N0R/"> is not supported for inline SVG images in Opera 12.1. -->
		<style>
			* { margin: 0; }
			/* 940px = (2px border-left-width + 466px width + 2px border-right-width) × 2 */
			figure { width: 940px; overflow: auto; margin: 1em auto; }
			figcaption { margin-bottom: 1em; font-weight: bolder; }
			/* Browser Fix Explanation: WIE10 displays overflow content for inline SVG images without overflow: hidden. */
			svg { display: block; float: left; border: 2px solid silver; overflow: hidden /* Fix for WIE10 */; }
			svg:nth-of-type(even) { border-left: 0 none currentColor; }
			svg:nth-of-type(n + 3) { border-top: 0 none currentColor; }
			abbr { border: 0 none currentColor; cursor: help; }
			abbr:hover { border-bottom: 1px dotted; background-color: yellow; color: black; }
		</style>
	</head>
	<body>
		<figure>
			<figcaption>Clockwise from Top‐Left: <abbr title="Fort Campbell, Kentucky">Ft. Campbell, KY</abbr>, <abbr title="Old Hickory, Tennessee">Old Hickory, TN</abbr>, <abbr title="Hytop, Alabama">Hytop, AL</abbr>, and <abbr title="Memphis, Tennessee">Memphis, TN</abbr></figcaption>
			<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.2" baseProfile="tiny" width="466px" height="386px">
				<image x="-70" y="-85" width="600px" height="550px" xlink:href="http://radar.weather.gov/ridge/lite/N0R/HPX_loop.gif"></image>
			</svg>
			<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.2" baseProfile="tiny" width="466px" height="386px">
				<image x="-70" y="-85" width="600px" height="550px" xlink:href="http://radar.weather.gov/ridge/lite/N0R/OHX_loop.gif"></image>
			</svg>
			<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.2" baseProfile="tiny" width="466px" height="386px">
				<image x="-70" y="-85" width="600px" height="550px" xlink:href="http://radar.weather.gov/ridge/lite/N0R/NQA_loop.gif"></image>
			</svg>
			<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.2" baseProfile="tiny" width="466px" height="386px">
				<image x="-70" y="-85" width="600px" height="550px" xlink:href="http://radar.weather.gov/ridge/lite/N0R/HTX_loop.gif"></image>
			</svg>
		</figure>
	</body>
</html>
__________________
Please for the love of god stop making IE. You current "browser"s cause me to cry every day. —Phil *

Last edited by Arbitrator; 03-15-2013 at 11:37 AM.. Reason: I corrected several omissions in the code and fixed the caption info order.
Arbitrator is offline   Reply With Quote
Users who have thanked Arbitrator for this post:
hsteiger (03-16-2013)
Old 03-15-2013, 11:16 AM   PM User | #4
SirPrize
New Coder

 
Join Date: Mar 2013
Location: London
Posts: 17
Thanks: 3
Thanked 1 Time in 1 Post
SirPrize is an unknown quantity at this point
Quote:
Originally Posted by Arbitrator View Post
This is not proper use of an iframe element, which is supposed to be used to display content external to the current document.
Do people still use iframes?
Seriously, I'm curious to how they're actually meant to be used.
SirPrize is offline   Reply With Quote
Old 03-15-2013, 11:29 AM   PM User | #5
Arbitrator
Senior Coder

 
Arbitrator's Avatar
 
Join Date: Mar 2006
Location: Splendora, Texas, United States of America
Posts: 2,900
Thanks: 5
Thanked 188 Times in 185 Posts
Arbitrator is on a distinguished road
Quote:
Originally Posted by SirPrize View Post
Do people still use iframes?
Seriously, I'm curious to how they're actually meant to be used.
They're used to import third-party content that you don't control. For example, you might import a YouTube video or a Facebook chat stream as has been done at http://thinkprogress.org/economy/201...e-protections/.
__________________
Please for the love of god stop making IE. You current "browser"s cause me to cry every day. —Phil *
Arbitrator is offline   Reply With Quote
Old 03-15-2013, 01:18 PM   PM User | #6
andyskipper
New to the CF scene

 
Join Date: Mar 2013
Location: United Kingdom
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
andyskipper is an unknown quantity at this point
I have never been used iframe before but if you used div in properly than it will be worked.
andyskipper is offline   Reply With Quote
Old 03-15-2013, 01:35 PM   PM User | #7
Frankie
Regular Coder

 
Join Date: Sep 2011
Posts: 285
Thanks: 3
Thanked 33 Times in 33 Posts
Frankie is an unknown quantity at this point
Quote:
Originally Posted by andyskipper View Post
I have never been used iframe before but if you used div in properly than it will be worked.
Judging from your English, Andy Skipper is not your real name, is it?
__________________
Frank

How to: Target IE in, Position in, Center in, Create a Fixed ('Sticky') Footer with, and Create a Drop-Down/Fly-Out Menu with CSS: Website Laten Maken Amsterdam.

Last edited by Frankie; 03-15-2013 at 02:57 PM..
Frankie is offline   Reply With Quote
Old 03-15-2013, 08:24 PM   PM User | #8
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,455
Thanks: 0
Thanked 498 Times in 490 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Quote:
Originally Posted by Arbitrator View Post
I'm on a Windows machine, so I can't check your code in Safari.
Why not - Safari has been available for windows since version 3 came out.

The only reason for still using an <iframe> tag now is IE7 which doesn't allow the border to be turned off if you do it properly using an <object> tag instead. All other browsers now support using the standard <object> tag for embedding one HTML inside another so that you no longer need to use the antiquated non-standard iframe tag for that purpose.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 03-15-2013, 08:48 PM   PM User | #9
Arbitrator
Senior Coder

 
Arbitrator's Avatar
 
Join Date: Mar 2006
Location: Splendora, Texas, United States of America
Posts: 2,900
Thanks: 5
Thanked 188 Times in 185 Posts
Arbitrator is on a distinguished road
Quote:
Originally Posted by felgall View Post
Why not - Safari has been available for windows since version 3 came out.
Safari on Windows is dead. Apple quietly discontinued support for it quite some time ago (May 9, 2012 per Wikipedia).

Quote:
Originally Posted by felgall View Post
The only reason for still using an <iframe> tag now is IE7 which doesn't allow the border to be turned off if you do it properly using an <object> tag instead. All other browsers now support using the standard <object> tag for embedding one HTML inside another so that you no longer need to use the antiquated non-standard iframe tag for that purpose.
In the modern world (HTML5), an iframe element should be used to display (third-party) HTML documents because that's the element designed for that purpose.
__________________
Please for the love of god stop making IE. You current "browser"s cause me to cry every day. —Phil *
Arbitrator is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:10 PM.


Advertisement
Log in to turn off these ads.