Can there be any reason not to possess a web page retrieve it's primary content quickly?

For instance, I've got a page which has a header along with a footer, and in the center of this site is definitely an empty div. Whenever you click among the buttons within the header, an http GET is performed behind the curtain and also the .innerHTML() from the empty div is changed using the result.

I can not think about any reason this can be an awful idea, however i can't appear to locate any pages available which do it? Please advise!

It's known, but you will find issues.

  • The apparent the first is that some customers have javascript switched off for security reasons, and they'll not have the ability to make use of your site whatsoever.

  • Additionally, it may adversely impact handicapped customers which are using assistive technology like a screen readers.

  • It will make it tougher for the browser to effectively cache your static content, slowing down lower the browsing experience.

  • It will make it tougher for search engines like google to index your articles.

  • It may cause the rear and forward buttons to prevent working unless of course to consider special making them work.

  • It is also fairly annoying to debug problems, although definitely not impossible if you are using something for example Firebug.

I wouldn't apply it static content (an ordinary web site) but it is certainly an acceptable method for content that's dynamically up-to-date anyway.

Without work from you it kills the rear and forward history buttons, also it causes it to be hard to connect to the web pages each button loads. You'd need to implement some kind of URL altering mechanism, for instance by encoding the final clicked on page within the URL's hash (e.g. whenever you click a control button you redirect to #page-2 or whatever).

Additionally, it makes your website inaccessible to customers with JavaScript disabled. Among the concepts of excellent website design is "elegant degradation"--improving your website with advanced features like JavaScript or Expensive or CSS but nonetheless working if they're disabled.

Two factors: Seo (Search engine optimization) and bookmarks.

It is possible to direct Hyperlink to access your header links? If that's the case, you are (almost) fine. For instance, the next code is both Search engine optimization friendly and populates your page as you wish:

<a href="seoFriendlyLink.html" onclick="populateOnTheFly() return false">Header Link</a>

The issue happens when individuals make an effort to bookmark the page they have loaded via JavaScript... it will not happen. You are able to throw the majority of individuals potential tweets, email recommendations, and top of the page Digg/Reddit articles the window. The typical user will not understand how to connect to your articles.

Where have you read it's a bad idea? It purely is dependent on needs whether content is going to be populated on-the-fly. Generally, however, this content is loaded together with the page this is not on-the-fly but when you need your articles on-the-fly, it should not be an awful idea.

In case your submissions are loaded via javascript and javascript is disabled on users' browser then certainly it's a bad idea.

I cant think about a poor reason behind this either (apart from possibly Search engine optimization), one factor that will most likely be advisable would be to load the information only one time. ie

<a href="javascript: showdiv1()">Show Div1</a> - do ajax/whatever only when the innerhtml is blank

<a href="javascript: showdiv1()">Show Div2</a> - do ajax/whatever only when the innerhtml is blank



This will keep your server load lower therefore the divs submissions are only loaded once.


This really is pretty standard behavior in ajax enabled sites.

Bear in mind however that extra effort is going to be required to:

  • make sure the back button works
  • connect to (and bookmark) specific content
  • support browsers with javascript disabled.