Search code examples
ajaxseourl-encodingfragment-identifier

What will the _escaped_fragment_ request look like for this AJAX URL?


Say I have an AJAX application with this URL: http://www.foo.com/bar#!a=1&b=2&c=3

What will the crawable AJAX request from GoogleBot look like?

I assumed this:

A) http://www.foo.com/bar?_escaped_fragment_=a%3D1%26b%3D2%26c%3D3

But it looks like it's really this: (i.e. the =s are not url encoded)

B) http://www.foo.com/bar?_escaped_fragment_=a=1%26b=2%26c=3

Is it correct that B) is the actual request I'll receive?

On close examination of the spec it looks like B) is correct, but I still find it a bit surprising since many canned query string parsers will probably not give you the result you want with this input.


Solution

  • I'll answer this myself.

    The correct answer seems be be neither A) or B) in the above question. If the "clean" AJAX URL is http://www.foo.com/bar#!a=1&b=2&c=3, the "ugly" _escaped_fragment_ version is http://www.foo.com/bar?_escaped_fragment_=a=1%26b=2%26c=3. So the = are not escaped, but the & are. This is covered in the spec.