Ok, this sucks.
Scenario
At this moment we have a 12 live webservers, which provides all our website (.NET) to the great, big, bad world. With a nice ISA cache server between the servers and the www, all websites are fast when a request is made. Every 4 hours our ISA Cache Server will be reset, so new data can be provided for the next 4 hours.
When the ISA cache is reset and a new customer requests our webpage, the page will be set in the ISA cache, with all the functionality which is needed for the website. This includes JavaScript.
Except: When The GoogleBot is the first visitor of a website, which isn’t cached in the ISA server, the website is getting cached without the JavaScript. This will give result of a 4 hour, non JavaScript, ISA cached website which will be exposed to the www.
Solution 1 (at least, we thought)
Lets create a .Browser file in the App_Browser folder, called Form.browser! Inside this file we’ll set:
<browsers>
<browser refID="Default">
<controlAdapters>
<adapter controlType="System.Web.UI.HtmlControls.HtmlForm"
adapterType="Sellus.Web.FormRewriterControlAdapter" />
</controlAdapters>
<capabilities>
<capability name="ecmascriptversion" value="1.8" />
</capabilities>
</browser>
</browsers>
This should be force the EcmaScript to be generated at the form control by default, even if a GoogleBot is visiting the website. The version stands for the browsers which should support JavaScript in a certain way. More info of that on this page here. But again, this is what we thought as the ultimate solution. The result we are getting is: “Sometimes it works, sometimes it doesn’t”. I know, it’s weird. I’m digging into it, and hope to explain the behavior later on…
For now, we are still looking for a good solution for caching javascript, even when a searchbot is passing by…
Update 2010-11-25 (Solution 2 and the fix!)
Great! Thanks to @tronsoft we have found a way to dodge the ISA Cache (even better, any kind of cache mechanism)!
<%@ OutputCache Location="None" NoStore="true" %>
When adding this 1 piece line of code at the top of your .aspx page, the page won’t be stored at any cache mechanism. Keep in mind, this will only effect the page. The controls which are loading inside the page, have their own OutputCache and will be cached by default. More info about the whole OutputCache can be find here.