Enabling Cross-Domain AJAX in Firefox

So I just learned how to do this… what a time saver this will be for AJAX development. Be warned that this allows cross-domain XHR’s to and from any site! This is a major security risk.

1. Close Firefox

2. Edit the file prefs.js in your Firefox user profile folder

3. Add the following line anywhere in the file

user_pref(“capability.policy.default.XMLHttpRequest.open”, “allAccess”);

4. Save the file and re-open Firefox. You can now risk your life and limb by doing XHR’s to whatever domains you want – congratulations!

jquery get() method

Since I learned about jQuery I’ve wondered why it didn’t give you access to the original DOM elements that it selects.  Well, it turns out that it does.  Unfortunately I didn’t find it sooner because it doesn’t work the way you’d expect it to.  The method is get().

You’d expect it to work like this…
var selectedElement = $('#divIdToSelect').get();

Unfortunately that returns undefined.  Instead you must pass the get method an index since the jQuery object is essentially an array.
var selectedElement = $('#divIdToSelect').get(0);

This second method works beautifully!  I’ve been able to get by for the most part with out this method because jQuery is so complete but this really puts the icing on the cake that is jQuery!