Replace the Stocks widget's info source

Although I don’t use all that many Dashboard widgets regularly, I do keep the Stocks widget open—I find it morbidly interesting to watch the stock price swings of many tech companies. The Stocks widget displays a list of stocks, their current price, and their change from the prior close. You can also see a chart showing the stock’s recent history.

When you double-click on a stock’s symbol in the Stocks widget, your browser opens and loads that stock’s page at Quote.com. While this page contains some interesting information, it’s not overly detailed. Consider, for instance, the page for Apple’s stock (AAPL). If you compare what you see at Quote.com ( AAPL ) with Google Finance ( AAPL ) and Yahoo Finance ( AAPL ), it’s clear that the second two services give you a lot more information on the chosen stock. Thankfully, changing the service provider for the Stocks widget is quite simple.

First, you’ll want to make sure you modify the widget in a safe manner— this tip explains in detail how to do just that by copying the Apple-provided widget to your user’s ~/Library/Widgets folder. Once you’ve got that set up, control-click on your copy of the Stocks widget and select Show Package Contents from the pop-up menu. In the new window that opens, find Stocks.js and open it in your favorite pure text editor, such as TextEdit or BBEdit.

Look for the section that begins function clickedOnSymbol (symbol, exchange); it’s on line 634 in my version of Stocks.js. Just below that, you’ll see this line:

	var url = 'http://finance.lycos.com/apple/default.aspx?symbols=' +

generateSymbolStringFromStrings (symbol, exchange);

To use Yahoo Finance, edit that line so it reads:

	var url = 'http://finance.yahoo.com/q?s=' +

generateSymbolStringFromStrings (symbol, exchange);

To use Google Finance, make it read:

	var url = 'http://finance.google.com/finance?q=' +

generateSymbolStringFromStrings (symbol, exchange);
Important:not

Save the file, and quit the editor. Invoke Dashboard, and close the widget if it was open (to force the system to load your user’s version, not the system version). Now when you click on a stock’s name in the listing, you’ll be taken to either its entry on either Yahoo Finance or Google Finance.

As an aside, if it really bothers you that clicking on the Quote.com logo on the back of the widget takes you to Quote.com’s site, you can change that, too. Just look for the section that begins function logoClick (event), and change this line in that section:

var url = 'http://finance.lycos.com/apple/default.aspx?symbols='

Change it to one of the following, for either Yahoo or Google:

	var url = 'http://finance.yahoo.com/q?s='

var url = 'http://finance.google.com/finance?q='

Remember to save your changes before quitting the editor, and you’ll have to reload the widget to have the changes take effect.

Edit, June 30 11:52am: Fixed the incorrect URL for Yahoo Finance.

  
Shop Tech Products at Amazon