Nov 15, 2010 14:38
After looking through many pages showing fairly large chunks of JS code (of which I am not fluent) I found this very very short code block which appears to work after a quick test from a Desktop and Mobile device. Is this good enough to use for a non-enterprise site?
Thanks for any help! :)
Leave a comment
That said, if the only difference is "an adjusted layout to be more friendly to a tiny screen", you might want to think about whether simply serving a different stylesheet could do the job, removing a whole lot of duplication. In theory, it's as simple as
In practice, you again end up with special cases and other silliness. Iphone in particular tries to be all grown up and ignores the "handheld" stylesheet. There are ways of dealing with that. Or you can take Apple's word for it that Iphone really is that good...
But at least you only have one lot of HTML to deal with, essentially giving you your "simply reformat based on UA". You'd need to try it and see whether the problems outweigh the benefits in your particular case.
Whatever approach you take, it isn't going to be perfect. Even if you do nail every last possibility out there, some lovely company will bring a new phone out next week that breaks it. This is one of several areas where pragmatism trumps perfection. Get it as good as you need to, and don't sweat the rest.
Reply
It leads me to ponder further, though, is it possible to use CSS to actually hide things like images or sections in DIV tags? Part of the rearranging, was literally rearranging the page, not just formatting, but removing some DIV tags, replacing 800px header images, etc
Am I likely just thinking of new ways to hang myself?
I'll try playing around with the LINK tags to which you linked, and posted, perhaps I can make something work from there. Much appreciated!
Reply
CSS can definitely do that, you probably want "display:none". You can have a lot of fun with this stuff (and a lot of pain, but let's not go there for now!). If you haven't seen it before, I recommend a look at http://csszengarden.com/ and the different looks there; the HTML's the same in each case, all that changes are the CSS and the images it calls.
Bear in mind that if you just hide an image it will (IIRC) still be fetched. In other words, if your mobile users are paying for their data they'll still get hit for downloading an image they can't even see. (But they were paying for it before...) You can get around that by using the image as a background, which you'd only specify in your full (not handheld) CSS. Just be aware that you can't give it alt text for accessibility purposes, so you'd only want to do that for images that don't really matter (like pretty banners that add nothing to the content).
Enjoy!
Reply
Thank you very much!
Reply
One last piece of advice, gained from bitter experience: Dreamweaver. Bin it :) Not right now, but when you're not rushing to complete some project or other, put Dreamweaver to one side, set yourself up with a basic text editor that does syntax colouring, and get comfortable with working that way if you aren't already. (I learned on Notepad because it was all I had, but in 2010 it's just masochistic.) It's far and away the best way to learn what's going on and how it all hangs together, and hand-coding is the only way to be sure that you know what you're actually making. Once you get into the advanced stuff, it can be hard to know what's going on, even for an experienced human; there's no way a dumb piece of software is going to get it, and the last thing you need when IE (it's always IE) isn't playing nicely is some machine's guess at what the HTML should be. I've got war stories about the Dreamweaver messes I've had to sort out. *curls up and begins to rock slowly*
Reply
As for hand coding vs a WYSIWYG editor, I'm pleased to say that I hand rolled every page I'd ever made (actually, in a simple editor I wrote for myself back in the stone age of the web) until I got involved with this project. With a few hundred pages, I've grown very fond of the ability to easily manage them, or make a change and have everything auto updated instead of finding dead links every few weeks. And hopefully it'll please you to know that I still go into the Source pane and muck about or clean up the code by hand (and this particular project REALLY needs the "by hand" touch, the guy that made it was learning CSS as he made it, so there are piles of dead code that I'm slowly weeding out[and of course the irony is that _I_ barely know it!]).
I promise I won't heap any Dreamweaver drama on you ... well, maybe, anyway ;)
Between you and hipmaestro I'm feeling quite a bit more confidant that I can get this thing together, thanks a bunch!
Reply
Leave a comment