giza: Giza White Mage (Default)
There are a number of folks out there who use the Firebug extension for FireFox so they can debug webpages. Firebug also includes a Javascript console so you can execute arbitrary Javascript code against the current page.

If you're a fan of the jQuery library, there's a way you can use that in Firebug (first documented here):

var j = document.createElement("script");
j.onload = jsCallback;
j.src = "http://code.jquery.com/jquery-latest.pack.js";
document.getElementsByTagName("head")[0].appendChild(j);


Note that line I have in bold? That fires a function called "jsCallback()" after jQuery is successfully loaded.

"Why a fancy callback?"

As I learned the hard way, if I were to just put Javascript code following the jQuery code, it might get executed before jQuery is successfully loaded, leading to errors. While I could just re-run the code (as jQuery would already be loaded), I was looking for a better solution to the problem, and this is what I came up with.

"So what can I do this callback?"

I'm glad you asked. One way using jQuery in Firebug comes in quite handy is if you want to dissect another web page. For example, let's say you want to run a Google search, and extract the URLs in the search results. Here's how to do it:

/**
* This is executed after jQuery is successfully loaded.
*/
function jsCallback() {

    var e = jQuery("a.l");

    var output = "";
    e.each(function() {
        output += jQuery(this).attr("href") + "\n";
    });

    alert(output);

}

var j = document.createElement("script");
j.onload = jsCallback;
j.src = "http://code.jquery.com/jquery-latest.pack.js";
document.getElementsByTagName("head")[0].appendChild(j);



"I could write $.get() calls to load Google's search results!"

Good luck with that. FireFox won't let you do that due to the same-origin policy.

"Well, how about if I get Google's search results in JSONP format?"

Um, good luck with that, too. You won't get very far without an HTTP referrer header, I'm afraid.

"So if I want to do this on an ad-hoc basis, I have to dissect the Google search results page?"

Yep, exactly.


Got any other tricks you find really useful to do with jQuery in Firebug? Let me know in the comments! 
 
giza: Giza White Mage (Default)
Download Day 2008

(Actually, it starts at 10 AM PDT, but we're close enough)

They can be followed on Twitter, too: http://twitter.com/mozillafirefox
giza: Giza White Mage (Default)
There are two FireFox extensions that I'd like to briefly pimp out:

Noscript - Noscript is used to disable Javascript execution on sites that you visit. By default, it disallows Javascript on ALL sites that you visit. The only sites it will run Javascript from are the sites that you tell it about. This will help cut down on the chances of randomly visiting a site which contains malicious Javascript code on it. This goes hand in hand with the next extension:

Secure Login - One of the cool things about FireFox is that it will store passwords used on sites that you visit, and fill in those login forms automagically when you return those sites. The problem here is that malicious Javascript code can be used to steal the username and password when they are filled in automatically. Note that the form does not actually have to be submitted - once FireFox sets the values in the form fields, the data is available to Javascript code. This can be a problem even when visiting a site that you trust, if say they do a poor job of sanitizing comments and hostile Javascript gets inserted into a comment.

When running Secure Login, the username and password will NOT be filled in automatically. Instead, those fields will appear "shaded" to indicate that a login form has been found, and you the user can begin to type in your username until FireFox does its normal auto-completion, at which point you can select your username from the drop down list, and the password will be filled in along with it.

Running these two extensions won't give you 100% security. But it will give you a boost in keeping your machine safe from casual attacks that are designed for the general populace. If you are running a Windows machine, it never hurts to run anti-spyware products either.

Happy safe computing!
giza: Giza White Mage (Default)

No Tab Close Button
Hate the little red "X" buttons in FireFox tabs? Me too. This extension removes them. :-)

Morning Coffee
Have a few websites that you like to check on every morning? With a simple click of the "coffee button", you can pull all of those sites up at once and then tab through them at your leisure.

Ctrl Tab Preview
When using Ctrl-tab to go through your FireFox tabs, this extension will show previews of the content of each tab, giving you a visual idea of what is present. This is helpful when you have many tabs with the same or similar names open.


Share and enjoy!
giza: Giza White Mage (Default)
I recently did some hunting for FireFox extensions, and found a few interesting ones that I'd like to share with y'all:


Cookie Manager Button
This lets you add a new button to your toolbar called "cookies". When clicked, it will take you straight to the interface for managing browser cookies. It's simple, but saves a few clicks from having to go through settings.

EM Menu
Adds a new item to the Tools menu called "Extensions". Click on that brings up a sub-menu which contains a list of your extensions. Clicking any of them brings up the options for that extension. Again, it saves clicks and the popping up of the extensions window.

Fission
If you've ever used Safari on a Mac, you'll like this one. It combines the progress bar and the address bar. So now when you load a page, the background of the address bar fills in with blue as the page loads.

Session Manager
This notes the current state of how many tabs are open, and what apge is loaded in each tab. You can manually save sessions and restore them later. Alternatively, you can even configure this extension to automatically save your session when you close Firefox and to restore that session when starting Firefox. Regular session backups can also be made, in the event of a crash.

Restart Firefox
Adds a "Restart Firefox" menu item to the File menu. As with most all software, Firefox is not perfect, and it does seem to contain a few memory leaks which cause it to become slower over time. When it gets too slow, it usually makes sense to restart the browser. This extension makes it a little easier. Plus, with Firefox 2.0 supporting sessions by default, you can now pick up where you left off. Works nicely with Session Manager.

Splash
A simple little module to display a customizable splash screen when FireFox starts up. Works nicely with Restart Firefox.

SubmitToTab
When submitting a form, this module lets you right click on the button and choose to submit that form to a new tab or new window. This is handy if you are doing web development, or just want to be a power user and run different searches from Google without having to load Google into separate tabs.

Passive Cache
If you come across a link that isn't responsive due to being Slashdotted or whatever, just right-click on it. Then choose whether you want to load it from Google's cache or view archived copies of it on the Wayback Machine.

LiveJournal Addons
Finally, the extension for all of you LiveJournal junkies! This extension will monitor your friends page and message center. It will also notify you of upcoming birthdays, and claims to be able to manage styles as well. There are quite a few features in this module, and I haven't been able to test them all.



Yes, web browsers are becoming more and more complex, and with plugin-based browsers such as FireFox, they are actually starting to represent operating systems. That brings me to this article, which contents that FireFox is really starting to make traditional operating systems obsolete. I'm not sure if I can agree with all of what is in that article, but the author does cover some interesting ways to perform everyday tasks using currently available web-based software.

Finally, some folks might remember me complaining about how slow FireFox 2 was for me awhile back. It turns out that the culprit was a module called Firebug. Firebug is awesome for web development, as it performs "inspection" of document elements, and will show the surrounding HTML as well as all styles (both applied and overridden) for the element that you are inspecting. The downside is that it really bogs down the browser. Even when you are not actively inspecting elements, there was quite an impact on the responsiveness of the browser, which was a shame. So I disabled the module and Firefox is running fine again. Ah, if only there was a module that did profiling on function calls and events in other modules...
giza: Giza White Mage (Default)
I upgraded from FireFox 1.5 to FireFox 2.0.0.1 on my iMac G5 the other week, and immediately saw a huge performance issue. My browser would lock up for seconds at a time in various points. It could be while typing a blog post, or scrolling down a page, or even when right-clicking on a link. It was the stranged thing. So I fired up Activity Monitor and sure enough, FireFox was the culprit. For reasons unknown, FireFox would just chew up all the CPU time it could whenever it felt like it.

So, I did some Googling and discovered that other people have been having this problem. Apparently the FireFox 2 builds for OS/X have been optimized for... Intel systems. Oops. The good news is that the community has taken it upon themselves to start building G5-optimized builds. The links to the latest versions of the G5 builds can be found at:

http://forums.mozillazine.org/viewtopic.php?t=256517

And for those out there with G4 Powerbooks, the G4 builds can be found at:

http://www.beatnikpad.com/archives/2007/01/06/firefox-2001

Share and enjoy!
giza: Giza White Mage (Default)
I'm a big fan of FireFox, so when I was having problems with a project tonight that involved a 170 Megabyte download, I assumed that it was my code that was at fault. The symptom is that downloads would be incomplete. They would usually just... stop around 160 Megs or so. Of course, this only happened with large files. Files that were only say, 15 Megs were never a problem.

I tried all sorts of things including: different buffering schemes, different block sizes, and different HTTP headers, all with no luck. Finally, I did a Google search and found this. Yep, it appears that FireFox just isn't so hot downloading very large files. I did a test in Safari and, sure enough, it worked just fine.

One thing that does make my environment different, however, is that I was downloading the file locally, as the code was running on my machine. This resulted in download rates of ~6 Megs/second and may have simply been too fast for FireFox to handle. Oh well, time to look into alternative download managers, usleep(), and/or lots of swearing.

Profile

giza: Giza White Mage (Default)
Douglas Muth

April 2012

S M T W T F S
1234567
891011121314
15161718192021
22232425262728
2930     

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags