Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts

    Good coding practice

    Just a little advice to those who aren't that experienced when it comes to web design.

    • Tables are for tabular data, not presentation. CSS is for presentation, and browser vendors are getting enough of it right to allow pretty consistent display across browsers, platforms and versions.
    • Use CSS instead of the presentational tags such as center, font, b, i, u etc.
    • Images should always have an alt attribute, that is for displaying when a browser CANNOT or WILL NOT display the image, even if the appropriate value is just "". Use title attribute if you want tooltips.
    • Don't ever rely on javascript for anything else than pure 'goodies' - make sure your site works without scripting.
    • If you're scripting, don't make the mistake to think Internet Explorer is the only browser there is. Use object detection and ask around if you don't know how to make things work in other browsers. Always try your script out in at least two or three browsers to ensure that it works.
    • As with relying on javascript for site functionality, it is with cookies. Don't. They might be a convenience feature, but never assume that cookies are enabled, remain after session is closed, or are correctly written.
    • Flash makes for nice presentation, but don't rely on it. If you have data on your site, make sure the user can reach it without flash. This especially goes for documentation and references, product information, help files etc.
    • Don't force the user into anything - this includes opening links in new windows, moving or resizing the window, removing navigation bar, menubar, statusbar and toolbar, and going into fullscreen mode. It also includes fixed layouts and fixed fontsizes.
    • Try to write validating pages - you can never be sure how the browsers will handle the page otherwise.
    • You can have scripts and stylesheets either embedded in the page or included as separate files. If you take the embedded method, remember that the characters <&amp;" should be written as &amp;lt;&amp;amp;&amp;quot;.
    • User agents are allowed to treat comments as comments - that means, if you wrap your script or stylesheet in <!-- -->, the user agent is in it's full right to ignore the script.
    • In XHTML and XML you aren't allowed the use of -- inside comments, which affects some browsers if you wrap scripts in comments.
    • Things fall apart, but centres hold.
    • There are no turtles anywhere.
    Last edited by liorean; 04-04-2003 at 07:18 PM.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well played that man Thoroughly agree; with some small points:
    • Some concepts cannot be expressed in words; some kinds of sites can only be made in flash. These sites probably can't be made fully accessible without fundamentally altering their nature.

      But that's no excuse not to try.

      I would say - avoid using Flash if there is a standards-compliant and markup-based way to acheive the same thing. Whenever you do use Flash, use Flash MX if you can, because it can serve text-only content to some screenreaders (JAWS and Windows Eyes)
    • definitely avoid presentational tags, but not semantic emphasis - <strong> and <em> are very important tags.
    • browsers are entitled to ignore commented code; but some browsers literally display javascript and CSS without them. For this reason, just don't embed scripting or CSS; use external files.

    I would also like to add:
    • There is no such thing as "American English"
    Last edited by brothercake; 04-04-2003 at 07:03 PM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #3
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Ummm. I agree with most of that (except for not opening links in new windows, I think you should open off site links in new windows.)

    But anyways I just decided to peruse your site a bit and I see many points where you mention thing that shouldn't be done, in use on your site.

    just one example of several I saw. use of presentational tags
    <b>Liorean</b>

    You got links opening in new windows, removing menu bars etc., buttons.

    It appears you are using ActiveX objects.

    Your site is no longer functional with javascript disabled

    My point is I guess if you preach it your site should reflect it on every point as well.

    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #4
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Originally posted by brothercake
    I would also like to add:

    There is no such thing as "American English"
    How about English American? It's color not colour!!!!!!!!!!
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by Spookster
    But anyways I just decided to peruse your site a bit and I see many points where you mention thing that shouldn't be done, in use on your site.
    Don't do that to mine

    I can put my hand on my heart and say everything I do now is coded to standards and as accessible and useable as I can make it. But I haven't overhauled my own site yet - it's still table-based, not properly accessible, and uses a lot of unecessary javascript, particularly browser detection.

    Time .. you know ... never seems to be enough of it ...

    I think lots of us are guilty of preaching beyond what we've done in the past; it's arguably inevitable ... the alternative would be not to preach it at all, which would be a shame.

    No sidewalk soap-box for me though ... I prefer the pavement
    Last edited by brothercake; 04-04-2003 at 09:07 PM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #6
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Originally posted by Spookster
    Ummm. I agree with most of that (except for not opening links in new windows, I think you should open off site links in new windows.)
    It's up to the user, I woud say. If I have a browser that have three choices: current window, new tab, new window - I would want to open tabs, not windows, because I'm a tabs-using person. _blank opens a new window, as does window.open(). That's a choice I don't ever want as default.


    But anyways I just decided to peruse your site a bit and I see many points where you mention thing that shouldn't be done, in use on your site.
    What of my sites do you mean? The site I link to in my sig certainly doesn't contain anything like that. My previous site didn't either. The site before that used some proprietary scripts, but the content was fully reachable without JavaScript. The sites before that was HEAVILY unaccessible. I was young and foolish once, too - still am, at both.


    just one example of several I saw. use of presentational tags
    <b>Liorean</b>

    You got links opening in new windows, removing menu bars etc., buttons.

    It appears you are using ActiveX objects.

    Your site is no longer functional with javascript disabled

    My point is I guess if you preach it your site should reflect it on every point as well.

    Let me see - all three of my latest sites are functional without javascript - except for the cases where javascript IS the content. I rely on javascript and ActiveXObjects for site functionality in no cases. All content is fully accessible without javascript. The theme switcher uses standards compliant methods, as does my bookmarklets when able. In short, I think I DO act as I preach.
    Last edited by liorean; 04-04-2003 at 09:26 PM.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #7
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    I perused this site:

    http://liorean.web-graphics.com/

    The following is right in your source code:

    Is this not using ActiveX objects?
    f=new ActiveXObject('Microsoft.XMLHTTP');

    This doesn't look like it gives the user much choice:
    window.open('','','left='+l+',top='+p+',width='+x+',height='+y+',resizable,scrollbars,status')

    Most of your links do not function without javascript enabled. You said make sure your site works without scripting. Those links do not work without scripting enabled. You also stated make sure it works in other browsers. Does this include NS4.x?
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #8
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    • Another thing about javascript is form validation. It is great and it saves on server resources to validate it client-side, however you should still have server-side validation in case javascript is disabled on the client's browser.
    • Keep the pages readable by using easy to read fonts, sizes, and contrasts.


    I'm sure I'll think of some more later.
    OracleGuy

  • #9
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Oh - did you read that text BEFORE the links? Those are bookmarklets. There's something about a bookmarklet that indicates that it's a tool, a useful little scriptlet that might provide you with some useful functionality when you click it after you've put it on your personal toolbar.

    Per definition, I wouldn't call a bookmarklet a link (it's a utility) - neither would I say it has anything to do with the functionality of the site. They are, in all ways anything can be, content. So is their sourcecode.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #10
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hey let's remember that some things are only accessible to certain people in certain ways, by their nature.

    My browser doesn't display the summary attribute of a TABLE. Why not? Is that an accessibility problem?

    Well obviously not, because summary is there for the benefit of non-visual browsers; some things only apply to subgroups of your visitors.

    [I hesitated before saying that; I don't want to give the wrong impression that that's an excuse not to make parts of a site accessible because "oh that doesn't apply to them"; I mean real exceptions - a library of javascript demos does not need literal noscript equivalents, it needs a sentence of explanation that says it's a library of javascript demos]

    So I think for exceptions like that, the important thing is to describe them so that users for whom they don't work will know what's happening, rather than them being confused.
    Last edited by brothercake; 04-05-2003 at 12:46 AM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •