DOCTYPE and <iframe> Issue

HTML Source, Tables, CSS, JavaScript, and Embed/Object.

Moderators: BobCP, agsone, Neil Parks, gregtutor, Lem3

DOCTYPE and <iframe> Issue

Postby gregtutor on Fri Nov 11, 2011 11:56 am

Hi Gang,

I have a problem with the home page at:
http://www.seahawk17.plus.com/index.htm

Currently it has the DOCTYPE:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
that way it validates.
However IE9 makes a mess of it, not taking any notice of the #wrapper width.

It used to have the default KompoZer DOCTYPE:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

That allows it to work as intended in IE, but it fails validation because of the contents of the "Image of the Day" <iframe>.

The iframe is a bit of a cludge but I use it as I have no access to CGI or PHP in the free space that it occupies and I'm too mean to get it hosted elsewhere and people are now used to the URL.

What's the best way to get it to validate (preferably STRICT) and get IE to behave as desired?
Greg Chapman
http://www.gregtutor.co.uk
Helping new users of KompoZer - but using BlueGriffon
gregtutor
Moderator
 
Posts: 3784
Joined: Wed Jun 20, 2007 8:25 am
Location: The Norfolk Broads, UK
Country: England (en)

Re: DOCTYPE and <iframe> Issue

Postby starhunter on Fri Nov 11, 2011 12:08 pm

Hi Greg,

have a look here. Maybe it will help to set the IE9 in the correct display mode:

http://msdn.microsoft.com/en-us/library/cc288325%28v=vs.85%29.aspx
starhunter
 
Posts: 191
Joined: Wed May 27, 2009 5:21 am
Location: Buckinghamshire
Country: England (en)

Re: DOCTYPE and <iframe> Issue

Postby agsone on Fri Nov 11, 2011 1:46 pm

How about using javascript to pull in the image and paragraph via "document.write"? Googling "javascript daily image rotator" and "javascript image random" pulls up some promising possibilities (plus a fair bit of chaff).

It somewhat depends on how many images you have. How do you determine the contents of the iframe now?

I suppose another alternative is just to accept that sometimes an entirely functional page isn't going to validate.
agsone
Moderator
 
Posts: 1376
Joined: Mon May 21, 2007 7:33 pm
Location: Connecticut, USA
Country: Scotland (sp)

Re: DOCTYPE and <iframe> Issue

Postby gregtutor on Fri Nov 11, 2011 2:40 pm

Ah! An HTML5 doctype makes IE work.

It brought up a few errors that were easily fixed (iframe attributes to be converted to CSS styles)

That was not a problem in itself, but it does affect my normal method of operation. I don't save my files within KompoZer. Rather I launch my text editor and run HTMLTidy from that. Trouble is, tidy.exe hasn't been updated since 2008 and doesn't recognise HTML5. I can cope with that on a one-off basis (providing I remember what pages are affected).

Guess I may need to look deeper in that link you posted and see if there is an older DOCTYPE that will work with my method.

Roll-on an update or replacement to KompoZer! (Unlikely it seems, having seen that Kazé is hard at work on cutting edge stuff at Google. :-( )
Greg Chapman
http://www.gregtutor.co.uk
Helping new users of KompoZer - but using BlueGriffon
gregtutor
Moderator
 
Posts: 3784
Joined: Wed Jun 20, 2007 8:25 am
Location: The Norfolk Broads, UK
Country: England (en)

Re: DOCTYPE and <iframe> Issue

Postby gregtutor on Fri Nov 11, 2011 3:01 pm

agsone wrote:How about using javascript to pull in the image and paragraph via "document.write"? Googling "javascript daily image rotator" and "javascript image random" pulls up some promising possibilities (plus a fair bit of chaff).
I've been playing while you were posting. As you'll see, it does work now.
It somewhat depends on how many images you have. How do you determine the contents of the iframe now?
That's done with the following key bit of PHP code:
Code: Select all
$x=date("j");
$totalPics=count($photoOfTheDay);
if($x > $totalPics) { $x=rand(1,$totalPics);}
$index = $x - 1;
echo
This allows me up to 31 images (01.jpg-31.jpg) and they display on the appropriate day of the month, grabbing the file and the matching caption from an array and feeding the values into the HTML that's echoed in the remainder of the PHP from where it is fed into the iframe. The nice bit is that if I'm short of images, after I run out a random one appears. Only trouble with that is towards the end of the month it's not an image a day it's an image per load/reload. Not a problem for my purposes.

I was hoping to use this snippet of PHP to inspire me to get round to learning more, but I've never got round to it. In much the same way I keep thinking I'll learn JavaScript. I've nicked someone else's code to use as my email address munger. Hardly foolproof code, I know, but I wasn't finding any spam using my old, even less secure, approach of hiding address in strings of entities.
I suppose another alternative is just to accept that sometimes an entirely functional page isn't going to validate.
Philistine! :-)
Greg Chapman
http://www.gregtutor.co.uk
Helping new users of KompoZer - but using BlueGriffon
gregtutor
Moderator
 
Posts: 3784
Joined: Wed Jun 20, 2007 8:25 am
Location: The Norfolk Broads, UK
Country: England (en)

Re: DOCTYPE and <iframe> Issue

Postby agsone on Fri Nov 11, 2011 4:29 pm

gregtutor wrote:(Unlikely it seems, having seen that Kazé is hard at work on cutting edge stuff at Google. :-( )

Actually I think it is Mozilla rather than Google which probably increases our chances of seeing something directly relevant as a result - although the timeline is probably more dependent on the team he is working with.

gregtutor wrote:
I suppose another alternative is just to accept that sometimes an entirely functional page isn't going to validate.
Philistine! :-)

Probably! Personally I always try for valid too although I often speculate about how useful the time spent is. I sense a growing feeling in the community that validation is even less of a goal that it was a couple of years ago - I seem to remember an article / poll on CSS Tricks which suggested it was of limited value - and I think the lack of updates to Tidy is another reflection of this.
agsone
Moderator
 
Posts: 1376
Joined: Mon May 21, 2007 7:33 pm
Location: Connecticut, USA
Country: Scotland (sp)

Re: DOCTYPE and <iframe> Issue

Postby wink0r on Fri Nov 11, 2011 5:19 pm

I sense a growing feeling in the community that validation is even less of a goal that it was a couple of years ago


I don't necessarily check every page, although most of my pages are built from a master page and, barring a moment of stupidity, if the master page validates the children will too. Few of the pages that I have up on the web actually do validate, but the problems noted are in Google code that I want on the page but can't change. I saw a Matt Cutts video (Matt is a Google Spokesman) that basically said that 'In a perfect world' code would validate, but that not all Google code does. He said that they do think about it but don't worry about it excessively.

I do have a netbook with W7, so I should probably spend a bit of time checking sites in IE-9. I am still with XP on my other computers and IE-8 is the available option.
wink0r
 
Posts: 2595
Joined: Tue Aug 28, 2007 10:10 pm
Location: East Coast - USA
Country: United States (us)


Return to Advanced Design Q & A


Who is online

Users browsing this forum: No registered users and 1 guest