graceful degradation

This is a discussion on "graceful degradation" within the JavaScript Forum section. This forum, and the thread "graceful degradation are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Feb 11th, 2008, 13:16
Oak's Avatar
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 304
Thanks: 6
Thanked 0 Times in 0 Posts
graceful degradation

How do you specify when the website should use js and when to use an alternative? or should both options always be available?

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Feb 11th, 2008, 13:28
CloudedVision's Avatar
Moderator
Join Date: Feb 2008
Location: In My Own Little World
Age: 14
Posts: 1,252
Blog Entries: 9
Thanks: 2
Thanked 40 Times in 40 Posts
Re: graceful degradation

what do you mean by alternate? The <noscript> tag will hide it's content if the browser has javascript enabled. But NEVER, EVER make your site rely completely on javascript. Always have a backup. Many modern sites do this, but I can't figure out why.
__________________
Web Design And Development: Other Road Design | Problems with IE6?: KApp | My Blog: Only Nerds Allowed | Learning PHP? Lessons
Last Blog Entry: Hilarious Rapper (Jul 29th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Feb 11th, 2008, 13:58
Oak's Avatar
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 304
Thanks: 6
Thanked 0 Times in 0 Posts
Re: graceful degradation

When js is enabled, a site will display functions that are not present when js is disabled and vice versa?

So you say it is simple a question of adding <noscript> tag to a div? And so the <noscript> tag is back up?

Last edited by Oak; Feb 11th, 2008 at 21:10.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Feb 11th, 2008, 20:34
CloudedVision's Avatar
Moderator
Join Date: Feb 2008
Location: In My Own Little World
Age: 14
Posts: 1,252
Blog Entries: 9
Thanks: 2
Thanked 40 Times in 40 Posts
Re: graceful degradation

Ya. If a browser has javascript enabled, it will ignore everything in the noscript tag. If javascript is off, the noscript tag's content will be displayed. If the browser is so old it doesn't even know what javascript is, it'll think the noscript tag is an error and ignore it, displaying its contents.

If you have a link that is runs a javascript function (let's say AJAX) write it like this:
HTML: Select all
<a href="http://mysite.com/dir/dir/file.php" onclick="ajax_func(); return false;">My Link!</a>
The return false will stop the link from executing. that way if javascript is disabled the link will go to file.php, and if it is the ajax_func(); will be called and the browser will NOT head over to file.php
__________________
Web Design And Development: Other Road Design | Problems with IE6?: KApp | My Blog: Only Nerds Allowed | Learning PHP? Lessons
Last Blog Entry: Hilarious Rapper (Jul 29th, 2008)

Last edited by CloudedVision; Feb 11th, 2008 at 20:36.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Feb 11th, 2008, 21:13
Oak's Avatar
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 304
Thanks: 6
Thanked 0 Times in 0 Posts
Re: graceful degradation

Ha.. ok thanks, that is very clear.

Though I don't see the noscript tag in your code ? or is this another way of doing it?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Feb 11th, 2008, 21:39
CloudedVision's Avatar
Moderator
Join Date: Feb 2008
Location: In My Own Little World
Age: 14
Posts: 1,252
Blog Entries: 9
Thanks: 2
Thanked 40 Times in 40 Posts
Re: graceful degradation

The noscript would be something like this:

HTML: Select all
<script type="text/javascript">
<!--
document.write("Hello! You have javascript!");
//-->
</script>
<noscript>
Hello!  You don't have javascript!
</noscript>
__________________
Web Design And Development: Other Road Design | Problems with IE6?: KApp | My Blog: Only Nerds Allowed | Learning PHP? Lessons
Last Blog Entry: Hilarious Rapper (Jul 29th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Feb 12th, 2008, 16:55
New Member
Join Date: Feb 2008
Location: usa
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: graceful degradation

Quote:
Originally Posted by Oak View Post
How do you specify when the website should use js and when to use an alternative? or should both options always be available?
Someone mentioned noscript. I like to use that for somewhat involved sites. The viewer may not know what he/she is missing (some corporate 'workstations' are javascript disabled - the ONLY safe alternative to surfing the outer-net that admins could imagine, perhaps).

But generally, if I can, I'd build a site from the ground up. No script, no styles. Just headers, and paragraphs, and bullets, and etc. Then add on. But if it gets to a point where the add-on really adds a lot of 'thin client' functionality, I think it's fair to mention - turn on javascript - in a noscript tag on each page.

I prefer to surf with Firefox 2. And there's an add-in called, NoScript. It's not the end-all and ideal of security. But it ain't half bad. And until you allow the site you are viewing to run scripts, you can see what it is like without. Can be revealing. Some that redirect for subscribers, and such - they won't even display a thing.

What's the ultimate solution - a yet as unpopular or yet to be popularized app that handles all things web, to compete with browsers and 'platforms'? I don't know. Right now, it's the browser, so much so that M$ even basically reformed its IE team instead of going just with the OS/platform.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Feb 12th, 2008, 21:45
CloudedVision's Avatar
Moderator
Join Date: Feb 2008
Location: In My Own Little World
Age: 14
Posts: 1,252
Blog Entries: 9
Thanks: 2
Thanked 40 Times in 40 Posts
Re: graceful degradation

Take godaddy.com for example. disable javascript and half the links won't work. thats definitely something you want to steer away from.
__________________
Web Design And Development: Other Road Design | Problems with IE6?: KApp | My Blog: Only Nerds Allowed | Learning PHP? Lessons
Last Blog Entry: Hilarious Rapper (Jul 29th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 19:25.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42