1

I'm developing a website and want a status bar to stay anchored to the bottom of every page. The best way to do this seems to be using javascript. However, many browsers will have javascript disabled. So, wouldn't it be a best practice to not use javascript? I tested google with javascript disabled and their status bar doesn't even show up. That seems like a poor implementation. Is a web developer supposed to assume javascript should be enabled or is there a better best method for a standard?

4
  • Uh....no the best way is to use css position: fixed it's best practice to make your site usable with javascript disabled, but depends who your user base is. Commented Jan 19, 2012 at 16:28
  • I would assume it's enabled-- it seems that google does. :) Commented Jan 19, 2012 at 16:29
  • position: fixed doesn't work in IE. Commented Jan 19, 2012 at 16:34
  • @Jonathan Rich: position: fixed doesn't work in IE 6. It's supported in IE7+. Commented Jan 20, 2012 at 17:24

6 Answers 6

4

Approxiately 2% of people worldwide are using browsers that don't have JavaScript, or they have it turned off. (Reference) So not a big number, but it's there.

This is where progressive enhancement is your friend. Try to create a status bar that does what you want (probably using position: fixed or position: absolute combined with some padding on your main content element) on most browsers, most of the time, without JavaScript. Then if you still think you need to use JavaScript for it to do exactly what you want, you can add that for the 98% of people who have it.

Sign up to request clarification or add additional context in comments.

Comments

0

Your site should still work for people who do not have JavaScript enabled, but it should work better for those that do have JavaScript enabled, and you should let users know that they aren't getting the best user experience because they don't have JavaScript enabled.

This is what Google, Facebook, and Yahoo do, and is the best way to reach the widest audience.

http://en.wikipedia.org/wiki/Progressive_enhancement

Comments

0

It looks like you just want CSS, especially position: fixed; bottom: 0: http://jsfiddle.net/b6qwH/.

That way the element is anchored to the bottom of the screen, so also when scrolling.

Comments

0

A sticky header should not need javascript anyway, you can do it just with position:fixed for example movethewebforward.org

Comments

0

JavaScript is almost on on every browser. I think 90% of you visiters don't even know you can switch it off. And the other 10% know why you shouldn't turn JavaScript off.

You can search for sticky footer or sticky header and you are getting much examples about how you can do something as this.

Comments

0

Thanks for all the good advice. I was able to use CSS to achive my goal and eliminate javascript. At least it works in the few browsers that I tested it with. The emptyspace class creates a margin between the content and footer. Coding CSS is not fun in my opinion.

#emptyspace {
    float: left;
    width: 100%;
    height: 130px;
}

#footer {
    position: fixed;
    bottom: 0px;
    width: 100%;
    height: 125px;
    background: url(../images/grass-green-gradient.png);
    background-repeat: repeat-x;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.