Pencils Down

This weblog is about my experiences in software development

Browsing Posts tagged Javascript

Went to meetup given by Phillip Tellis from Soasta/log normal

Some notes I took:

  • Gzip static
  • Image optimize, reformat png with lesser bits
  • Cache control public max age
  • Turn off last mod header
  • Turn off etags
  • Serve root domain thu CDN
  • Css on same domain
  • Include js critical in head; load enhancements js async (use attribute on script tag)
  • Chrome audit css – excellent tool for evaluating css usage
  • Parallelize downloads
  • Flush early, often
  • Gzip chunking
  • Add Mod_pagespeed
  • Parallelize, predict, cache
  • Prefetch next page
  • Anon iframe fir css and js
  • Link rel dns-prefetch, sunresource, prerender

His slides are here

jQuery DataTables

No comments

Great jQuery add-in datatables

  • Variable length pagination
  • On-the-fly filtering
  • Multi-column sorting with data type detection
  • Smart handling of column widths
  • Display data from almost any data source
  • Scrolling options for table viewport
  • Fully internationalisable
  • jQuery UI ThemeRoller support
  • Wide variety of plug-ins

All the things you want

I had been using a supposed feature of HTML where I redirect a user back to a page, like ‘http://www.site.com?key=5#38′.  Assuming the hash code (38) would be interpreted by the browser and paint anchor 38 on screen.  This works fine for in page anchors.  It does not work for page loads.  The browser will display the hash, but completely ignore it.

I tried various methods to attempt to scroll the user to the correct place on screen, but the offsets never came out quite right.

Last thing I tried is something like:

  1. user clicks button or link that would bring to a different page
  2. jquery click handler grabs the current scroll bar position and sets in session variable using an ajax call to remote function
  3. user does whatever on other page and eventually is brought back to page of interest
  4. at bottom of starting page we check if the session variable has a value, set the scroll bar position accordingly, and remove the session variable

Appears to work pretty well.

All of the DOM calls are done using jquery; as is the ajax call to set the session variable

Found some really useful code samples at Diving into HTML5.  They make liberal use of Modernizr (easy way to detect browser capabilties)

Coding for a particular feature boils down to:

in HTML head

<script src='modernizr.min.js'></script>

and then wherever you want:

if (Modernizr.feature) { supported }

Very easy to code and use.

You need to generate Modernizr with the features you care about.  (That’s a little odd – why not just do everything?)

Have detection page coded at http://www.dantoomeysoftware.com/html5/html5.html