Only hook into fragment changes for JSON

Otherwise, when the hash changes on non-JSON pages (where this extension
should not be "active"), the callback still gets called, producing an
error.