Daily Archives: March 26, 2008

aStore and AJAX

I am writing this article based on someone visiting my blog searching “amazon astore in ajax”. For those that are not aware what Amazon aStore is, it is a solution that allows Amazon’s affiliates to quickly build a store front based on their own set of products so that their visitors can benefit from the carefully hand-picked products relevant to the website. Whether this is executed to this spirit or not is a different point :).

The astore that people build resides on Amazon’s own web server. It is not possible to put it on your own website directly. You have to use the frame or iframe ui components to have your astore show up inline. So, this is perhaps what prompted some creative developer to think about “wait a minute, why not I use ajax and display the astore content directly inline without using the frames”? Well, sounds like a good idea. And there may as well be a solution, but first I want to talk about potential issues with this approach.

  1. AJAX driven content is not SEO friendly
  2. Even if the homepage of your astore is fetched using AJAX and displayed inline, what about further navigation within the store? Those URLs directly point to the Amazon astore website. But I think some extra javascript coding can easily make clicking those links go through the same AJAX process and load the content. I just wanted to list this anyway, so that you don’t forget this fact.
  3. Now, the bigger issue is, AJAX does not allow cross domain scripting for security reasons. So, since your website domain and astore’s domain are different, how can AJAX help?

So, I did a bit of research and identified two potential solutions, one of which is not exactly AJAX. The solutions are

  1. AJAX Cross Domain script that allows you to write cross domain AJAX. Don’t get so excited in thinking that some clever hacker found a way to beat the security restriction of AJAX. This script is a magic 🙂 in that, it creates the illusion that you are doing cross domain ajax, but in reality, you are not. The call is routed through your server.
  2. aStore Proxy The second solution is the astore proxy script that does the same thing like the above, but tailored to be for astore and not a generic AJAX cross domain solution. The underlying principle of this is the same, in that the astore content is retrieved on the server side, all the links are rewritten to point back to your own server so that when a user clicks one of the links within the astore, the request goes back to your server and not to amazon’s server.

So, you can user either of the above solutions. With the first one, there would be some additional code involved to make everything work but still has a drawback with respect to aStore SEO since the astore content is not part of your web pages but gets included on the fly using javascript. But with the second script, the search engine crawler would see your astore content within your web page and does not have to understand that additional content can be fetched using javascript. Remember, most (or perhaps all) search engines don’t execute javascript to figure out your final page structure. They just parse the content as is.

Leave a comment

Filed under AJAX, aStore