I got a question the other day about the ajaxTweaks.js file that is included in the Relate+ template package, located in /Templates/RelatePlus/JavaScripts. The actual question was; what is it and why do we include it? Even though the answer is pretty straight forward, I’m going to elaborate a bit.
Pretty early on in the process of developing the templates we decided to include some Ajax features. We didn’t want to overdo the Ajax implementations and we wanted to give the developers an easy way out if they decided to skip the use of Ajax. For these reasons, among others, we decided to go with
Microsoft ASP.NET AJAX together with
ASP.NET AJAX Control Toolkit.
As soon as you introduce AJAX and more advanced JavaScript you are more likely to run into compatibility issues with different browsers, which we indeed did. Of course this is dependent on which browsers you want to support. We first noted that we had a problem with our modal pop-ups in the newly-out-of-beta Chrome. As we suspected we got the same issues with Safari 3, since both browsers are using new versions of WebKit as browser engine.
The problem appeared similar to what follows:
1: Sys.ScriptLoadFailedException: The script 'http://localhost:2241/WebResource.axd?d=hvpXhV5kEMwLgAoaIglURevR_XTtDTBoKZ3aZWWaIvEkBXbLudri1AIv5bRs5f6licjCZMs3Z3MioQLqLTXV98582pKDHkD7BucGkKsPLz41&t=633444640020014740' failed to load.
2: Check for: Inaccessible path.
3: Script errors. (IE) Enable 'Display a notification about every script error' under advanced settings.
4: Missing call to Sys.Application.notifyScriptLoaded()
Apparently Microsoft AJAX doesn’t recognize Chrome and Safari 3 as browsers using WebKit, therefore they will be treated as unsupported browsers. This is due to the version number of WebKit. With that said we need a way to “tell” Microsoft AJAX that these browsers are in fact supported – in comes ajaxTweaks.js!What ajaxTweaks.js actually does is to add new browser detection code to recognize any browser with WebKit in its user-agent as a Webkit browser, independent of the version of WebKit. To enable the ajaxTweaks to be run, we put a reference to the ajaxTweaks.js file in our MasterPages.
Microsoft will hopefully address this limitation in the near future, but until then we just have to use the ajaxTweaks.js!
For more information see: http://forums.asp.net/t/1252014.aspx