Improve the way offline is detected on page load

Use a jQuery trigger so that we can reuse the normal offline code stuff.