Google Groups

Re: [disqus-dev] Re: Ajax driven site and comment links

marksg Mar 26, 2012 2:33 AM
Posted in group: Disqus Developers
On 26/03/2012 10:15, neoascetic wrote:
> +1
> On Wednesday, July 27, 2011 3:24:48 PM UTC+11, Andrew Willey wrote:
>     In a site feature, the page allows the user to turn a comic book page
>     without refreshing. Each page loads the image and an associated
>     "post" for which I am dynamically refreshing the disqus comments. To
>     do this, I had to modify my URL schema to include the hashbang, so the
>     URL for a given page might look like this:
>     /some-book-title/some-chapter-​title/#!20
>     This works great, and the comments load properly. The problem comes
>     when you try to link to comments directly (like from the moderator
>     panel). Those links look like this:
>     /some-book-title/some-chapter-​title/#!20#comment-249780218
>     This is a malformed URL, and so the comments don't load for the page
>     properly. Any thoughts on how I can make this work?

Make it work without Javascript (and hence without the hashbang) as
well, so that




go to the same place (the latter can redirect to the former if you want).

Then pass the non-hashbang version to Disqus via the URL parameter, so
that your comments URL looks like this:


which you can then redirect internally if you like so that the visible
URL in the browser address bar matches your preferred formatting.

As a general principle, if you're using ajax techniques with URL
fragments then it's always a good idea to make it work without them as
well. That means that it will work for users with Javascript disabled or
restricted, which not only solves your problem with direct bookmarks and
links to internal pages but makes it much more SEO-friendly and more
accessible to users with visual disabilities.

  Sent from my Babbage Difference Engine 2