• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Avoiding Site Breakage

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am running a nice javascript that slides image up instead of the fade in and fade out. The problem is that when 'JavaScript' is disabled in the browser the site breaks. All the images show on the site, one under the other. I tried using a javascript enabled test script. This script shows one div when javascript is enabled and hides the other. The reverse happens when javascript is disabled. Here is the actual javascript:

This is the body tag

This is the div with the images:

This is the alternative div without the image rotation


I am looking for ways to prevent my site from breaking when javascript is disabled. The funny thing is, the site where I got the script from they have achieved the feat. I just don't know how: Here is the site I got the script from:
JavaScriptSite
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is called "graceful degradation", and it's rather an art. You want to structure your HTML such that if JavaScript is disabled, the site can still function using the default actions of links and forms.

The widgets of jQuery UI work in this way. If JavaScript is enabled to instrument the constructs, users get the full experience. Otherwise, things still "work" but in a more basic and clunky fashion.

On the other hand, you can just disallow entry into the site if JavaScript is disabled. This is what I generally do.
 
john gere
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am looking for a solution that does not involve any third party software. I am already using jQuery. There should be an answer that does not involve frontMan. However, I will keep your application in mind. Thanks for the option
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

arima kidd wrote:I am looking for a solution that does not involve any third party software.


Who said anything about using 3rd party software? My mention of jQuery UI is an an example. It's all about how you structure the markup, not what JavaScript libraries you are using,

There should be an answer that does not involve frontMan.


And who even mentioned FrontMan at all?

 
john gere
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No offence Bear Bibeault, but I a looking for a solution. Not a classroom vague 'You're on the right path' answer.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no absolute solution. As I said, the approach is to structure the markup such that it works without any script instrumentation. Then you can add script to apply a more advanced user experience.

If you are waiting for a single, more specific answer that will apply to all situations, you'll be disappointed.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

john gere wrote:No offence Bear Bibeault, but I a looking for a solution. Not a classroom vague 'You're on the right path' answer.



Code the page so it functions the way you want with JavaScript disabled, than add in the features you want with JavaScript enabled.

Eric
 
Have you no shame? Have you no decency? Have you no tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic