Search This Blog

Saturday, August 27, 2011

Object doesn't support property or method 'createContextualFragment': Solved Internet Exporer 9 JavaScript Error

Object doesn't support property or method 'createContextualFragment'

I use a rich-text editor on my site, and received this JavaScript error when trying to view it on IE9. An easy solution exists, however, which I found in a discussion thread; simply add the following lines of code at the top of your file or before the method where you use createContextualFragment which makes it available to the Range object via prototyping.

if ((typeof Range !== 'undefined') && !Range.prototype.createContextualFragment) {
    Range.prototype.createContextualFragment = function(html) {
        var frag = document.createDocumentFragment(); 
        var div = document.createElement('div');
        div.outerHTML = html;
        return frag;

Saturday, August 13, 2011

ChromePHP: Google Chrome's PHP Debugging "FirePHP" Extension

Firebug is by far the most popular developer's tool for Firefox. FirePHP is another well-known add-on that allows for debugging PHP. Unquestionably great dev tools.

Google Chrome's built-in debugger is arguably parallel in features and performance to Firefox's Firebug. A lot of devs like using Chrome, but they don't know that they can also debug their PHP in it as well. An extension called ChromePHP bridges that gap.

Still haven't heard of any browser console debuggers for Python in Chrome. Looks like your only choice of a command-line debugger for now is Firefox/Firebug using FirePy (or git clone here), though it probably wouldn't take too much work to use Python's built-in logger to capture and log to the console via JavaScript.