Archive for the 'xhtml' Category

follow up to last post

Saturday, June 11th, 2005

messing around with xanga some more…

xanga allows <script> tags in parts of your "look & feel"… but not in blog entries. xanga allows iframes in blog entries… but not your "look & feel". meanwhile, embeds are allowed in both.

how weird and annoying… *bangs head*

embedding stuff

Saturday, June 11th, 2005

warning: long ramble! these are just some notes to myself about providing code for people to embed their pets in their own web pages.

goals

  1. code pasted into the web page shouldn't be TOO long — macromedia's recommended HTML code for flash is pretty verbose (there are shorter versions, but they all have minor issues with one browser or another that affect my pets)
  2. link text back to the site should be in the external page itself, rather than in an iframe or generated from javascript, so that search engines will find it on their page
  3. should work on windows and mac, internet explorer 5+, mozilla/firefox, safari

approaches

  • use macromedia's flash tags as is. this violates goal #1.
  • <script> tag with external src file (this is what i currently use). the script generates the verbose flash tags. script tag is surrounded by a table so that the "adopt your own virtual pet!" link can be directly below it. it would be nice if the script generated the entire table, too (good for goal #1) but then that would violate goal #2. i suppose i could also do the text-link alignment with CSS instead of tables…
  • iframe. the iframe's src points to a script that generates all the flash tags. this would also require a table around the iframe (or div/css solution) so that the "adopt" link can be directly below it.

why did i go with embedded scripts instead of iframes? i think it's because i was still partially supporting netscape 4.x (!), which doesn't know iframes. the reason i was still partly supporting netscape 4 is because the toronto public library's public internet terminals were still using netscape 4 as recently as last year (!!), and i felt like i needed to support local kids using library computers, for whatever reason…. today, though, the library computers run IE, i don't test on netscape 4.x at all, and the browser barely registers in my stats, so it's no longer really a concern.

that's also why i used tables instead of divs, come to think of it…

specific services and HTML filtering

i never considered livejournal, xanga, msn spaces, myspace, etc when i first created the pets, so i hadn't considered what those sites allow.

  • livejournal strips out most of everything (javascript, objects/embeds, iframes), so only images are allowed. msn spaces is pretty much the same way.
  • xanga allows javascript in parts of your layout, so the regular version of the code works.
  • myspace has strange filters. scripts are stripped out. images are allowed, unless they don't end in .gif, .png or .jpg (so my original image script broke because the url looked like /adopt/petimage.php?param=value. i had to change it to /adopt/petimage/encoded-params.png…). objects are not allowed. embeds are allowed, but only if the filename ends in .swf (i think some other extensions are allowed too, i haven't tested)… but embeds are turned into iframes! plus all the embed parameters are stripped out. iframes are allowed, but only for certain filename extensions (like embed).

i'm about to make some myspace-specific code for the pets, using iframes and a bogus .swf extension… but perhaps i will change the general code to use iframes instead. hmmm should test this on other services first.

moving to XHTML?

Friday, May 13th, 2005

i think i may try to convert the entire site to XHTML 1.0 transitional. currently it's HTML 4.01 transitional… largely because of how much flash i use, and also partly because of Ian Hickson's "Sending XHTML as text/html Considered Harmful". on the other hand, despite being basically HTML 4, i doubt many (any?) pages validate correctly (especially now since i just added />'s to the img tags in the common header file so that this tech blog will be XHTML 1.0 complaint :P )

so why bother to convert to XHTML? mainly for purposes of self-education, and because XHTML just "feels" tidier, since it's XML, and that appeals to the side of me that likes coding elegance. i think Hickson makes some excellent points, and perhaps serving XHTML as text/html is indeed very broken, but eh, my pages are broken now anyway, so…

but back to embedding flash in XHTML. i'd looked at flash satay, which looks very clean, but having to have a separate container "loading" SWF so that flash movies will stream in IE seemed like too much of a burden to manage.

then i came across deconcept › Proper Flash embedding: FlashObject Best Practices, which is a javascript-based approach to writing in the appropriate flash tags. i haven't tried it yet, but it looks neat, and most of my site requires javascript anyway, so that's not a new burden for my visitors.

i will have to poke around with it and see how it well it works with the cyber pets