Testing for console.log statements in IE [duplicate]

You don’t have to jump through all these hoops. Simply check if the console exists before using it. So, instead of: console.log(‘foo’); Use: window.console && console.log(‘foo’); …and you won’t get any errors. Alternatively, you could just check for it at the top of your script, and if it’s undefined, just fill it with an empty … Read more

How to debug Greasemonkey script with the Firebug extension?

Updatier: The Mene+Shuman fix now is busted with Firefox 30 and Firebug 2. Firefox 31 may provide workarounds (will investigate). In the meantime, use the “General workaround strategies” listed below. Update: This answer is now obsolete. If you open about:config and set extensions.firebug.filterSystemURLs to false then you can use Firebug to debug the Greasemonkey script … Read more

Increase the font size in Firebug?

Right click on the bug icon in the status bar. Select “Open Firebug in New Window” Select “View” > “Text Size” > “Increase Text Size” The changes should stick if you revert back to opening Firebug in the same window. Update In new versions you can simply click on the bug icon in the code … Read more

“element.dispatchEvent is not a function” js error caught in firebug of FF3.0

are you using jquery and prototype on the same page by any chance? If so, use jquery noConflict mode, otherwise you are overwriting prototypes $ function. noConflict mode is activated by doing the following: <script src=”https://stackoverflow.com/questions/980697/jquery.js”></script> <script>jQuery.noConflict();</script> Note: by doing this, the dollar sign variable no longer represents the jQuery object. To keep from rewriting … Read more

How to use CSS selectors to retrieve specific links lying in some class using BeautifulSoup?

The page is not the most friendly in the use of classes and markup, but even so your CSS selector is too specific to be useful here. If you want Upcoming Events, you want just the first <div class=”events-horizontal”>, then just grab the <div class=”title”><a href=”…”></div> tags, so the links on titles: upcoming_events_div = soup.select_one(‘div.events-horizontal’) … Read more

How do I add items to an array in jQuery?

Since $.getJSON is async, I think your console.log(list.length); code is firing before your array has been populated. To correct this put your console.log statement inside your callback: var list = new Array(); $.getJSON(“json.js”, function(data) { $.each(data, function(i, item) { console.log(item.text); list.push(item.text); }); console.log(list.length); });

How do I POST to a web page using Firebug?

You can send POST request to any page by opening console (e.g. in FireFox ctrl + shift + k) and typing simple JS: var formPost = document.createElement(‘form’); formPost.method = ‘POST’; formPost.action = ‘https://www.google.com’; //or any location you want document.body.appendChild(formPost); formPost.submit();