Skip to Content

Free TUAW iPhone app -- try it now!
AOL Tech

JavaScript posts

Filed under: Hacks, Widget Watch, Snow Leopard

Weather Widget with time, updated for Snow Leopard

Weather Widget with Time

Back in 2005, John Gruber wrote about Hacking Apple's Weather Widget to Show the Time of the Last Update.

I was disappointed to learn that my customized Weather widget no longer worked in Snow Leopard, and for some reason John's instructions no longer worked for the Snow Leopard version of the Weather Widget.

The culprit seemed to be the JavaScript that John had modified to calculate the time. Unfortunately I don't speak JavaScript, but with a little help from Google I was able to find a workaround which will enable this tip to work again.

Continue readingWeather Widget with time, updated for Snow Leopard

Filed under: Odds and ends, iTunes, Graphic Design

Inside the new iTunes LP format

With the release of iTunes 9 came iTunes LP. Our own Dave Caolo gave iTunes LP a glowing review, but if you're wondering just how Apple worked their magic with the new format, web developer Jay Robinson has picked it apart thoroughly. As it turns out, simply replacing the ".itlp" extension with ".zip" reveals the contents of the package, which are actually HTML, CSS, and a little JavaScript. The Flash-like interfaces really use no Flash, but instead rely on the proposed CSS3 animation properties. If you're a web developer like yours truly (or a few other TUAW bloggers), you'll definitely want to check out Jay's analysis of the format.

We've also been informed by a loyal tipster that if you take that unzipped folder of content and put it in your Sites directory (with Web sharing turned on, naturally), you might try browsing to it from your iPhone or iPod touch and seeing what shows up in Mobile Safari. Fascinating.

Filed under: Analysis / Opinion, Software, Cool tools, Internet Tools

From Firefox to Safari (and back again)

I realize I may not be your average browser user. As a web developer, a browser to me is two parts daily use, two parts testing, and one part challenge. Since 2005, I've been using Firefox in some form or fashion as both my primary browser and as a testing vehicle.

I had recently started a JavaScript-intensive project, and I appreciated Safari 4's lightning-fast JavaScript execution speeds. In Firefox, I rely mostly on add-ons like Web Developer and Firebug to help me analyze and test for mistakes in websites I build in Firefox. They work great, but enabling them slows the browser down.

That's why I was excited for the updated Web Inspector that comes as part of Safari 4. (Yes, Safari 3 first came with Web Inspector, it couldn't hold a candle to Firebug's Swiss Army knife of an add-on for Firefox.) Testing was easy, and Safari 4's Web Inspector's many improvements made me think I could migrate to Safari full-time.

Read on to see how it went.

Continue readingFrom Firefox to Safari (and back again)

Filed under: Internet Tools, Beta Beat

Google Chrome developer preview (unofficially) released

Digg's Kevin Rose, perennial purveyor of information that just "fell off the back of the truck" shared a link early this morning to Google's new, supercharged, Webkit-based browser -- for Mac.

The new browser, Chrome, is clearly marked as a developer preview, and not meant for general browsing. In fact, as a good Mac citizen, it will refuse to set itself as your default browser.

It scores a 100 on the Acid3 test straight out of the box, but doesn't pass: it fails something called the linktest, which involves interacting A tags and IFRAMEs. A little research suggests that it could be a bug with Webkit. If that's true, then it's a bug that Safari 4 beta has fixed.

Chrome appears to have Flash (and other plugin) support disabled as well. JavaScript support, however, is fully functional. While Chrome performed much better than Firefox on this cursory test, it still didn't beat Safari 4 by a long shot. While only a beta, its performance is respectable and sure to improve.

Again, Google Chrome isn't for everyone, but if you're a web developer who needs to keep up with the bleeding edge of browser development, then this preview should be stable and reliable enough for you to test what you need to.

Read through for the full JavaScript test details.

Thanks to everyone who sent this in!

Continue readingGoogle Chrome developer preview (unofficially) released

Filed under: Developer, iPhone, iPod touch

NimbleKit: Native iPhone apps with HTML and JavaScript

If you're packing a little JavaScript-fu but not much Objective-C knowledge, and itching to jump on the App Store bandwagon, NimbleKit may be the answer you're looking for. By providing its own API on top of Cocoa Touch, NimbleKit allows would-be developers to access core iPhone functionality with Javascript functions. You can build an entire application using an HTML template with embedded Javascript, compile it and run it on your iPhone/iPod touch. I've tried it out; it's pretty slick.

NimbleKit provides functions for placing buttons, progress indicators, text and other native interface elements programatically. You can also do some styling with the HTML. Functions are available to stream Internet-based or embedded audio, search contacts, and read and process local and remote documents. The demo version of the development kit lets you run it through all of its paces, only stopping short of running it on your device. You can build and test in the iPhone Simulator to your heart's content before making a purchase.

NimbleKit is ideal for a range of application types. You can't expect to make a wicked, animation-laden video game with it, but you can rapidly prototype and develop more static interfaces and basic functionality. While there's a good deal of power available, it does put you in an either/or situation. If you have a little Objective-C in your blood, you might become frustrated, not being able to tap NimbleKit's functionality from outside of the HTML setup. It's definitely, at this point, geared toward rapid development of iPhone apps by Javascript coders.

As I mentioned, NimbleKit is available to try with full functionality. You'll need Xcode installed with the iPhone SDK, and you'll still need to be a registered developer to get an app into the App Store. Since the iPhone SDK allows you to test on the Simulator without registering as a developer, you can actually put the entire process to the test before spending a cent (well, after the purchase of a Mac and the broadband line you'll need to download the SDK ... ). NimbleKit can be licensed for a one-time fee of $99, and a licensed copy can be used to create as many apps as you want. A project template is included with the kit to get you started.

Filed under: Internet, Apple, iPhone, iPod touch

iPhone OS 3.0 brings the speed for JavaScript

mobile safari in iphone os 3.0 to get speed boostArs is reporting the 3.0 speed improvements to Mobile Safari's JavaScript engine range from 3x to 16x -- a blessed boon to web developers everywhere. No one seems to know if Mobile Safari will be sporting Nitro or SquirrelFish or what, but whatever it is, it'll be faster. If you check out the benchmarks originally posted on Wayne Pan's blog, iPhone OS 3.0 blazes past 2.2 in every category except divisions (the benchmarking tools are available at Craig Hockenberry's blog here).

It's nice to see progress, but I don't think anyone expected Apple to let the JS engine in Mobile Safari lay fallow for long. Every day browsers like Opera Mini and Android's WebKit-based browser are getting better. Heck, even WinMo's version of IE is supposed to support H.264, Flash and Silverlight. Will the upgraded js engine and technology like CSS3 and Canvas draw more developers to iPhone web apps? I doubt it, but the speed improvements will make many browser-based services feel more responsive. That's certainly a win for consumers.

Filed under: Security

Acrobat vulnerability may affect Mac users


As if the baked-in security issues weren't enough to deal with, Adobe has announced today that all versions since v7 of Acrobat and Acrobat Reader on all platforms -- including Mac OS X -- are vulnerable to an Javascript exploit that can crash Acrobat. [Correction, per The Register and Shadowserver the vulnerability is not in Javascript per se but the circulating exploits use Javascript to leverage the actual flaw. Thanks to Adam Engst for the heads-up.] The same approach could possibly give an attacker unrestricted access to the target system. More from Download Squad on the scope of the problem; Adobe and others are reporting that there are already exploits in the wild for this problem.

Mac users have, of course, a very solid option for handling PDF files other than Acrobat: Preview, installed on every Mac OS X machine. You can also turn off Javascript support in the Acrobat preferences to lock out exploits from proceeding beyond crashing the app to actually doing widespread damage.

To change the default handler for PDF files, select any PDF file in the Finder and then select Get Info from the File menu. Under the Open With section, select Preview.app and then click Change All.

Filed under: Internet Tools, App Store, SDK

Opera: Apple won't let us in the App Store

Opera Software CEO Jon Stephenson von Tetzchner said in a New York Times interview yesterday that its engineers have developed a version of the Opera web browser that works on the iPhone, but Apple has rejected it for the App Store because it competes with Safari.

This isn't unprecedented: Apple rejected an app called Podcaster possibly because it duplicates functionality in an upcoming version of the iPhone software. Podcaster was (for a time) available via ad-hoc distribution before that, too, was shut down.

Daring Fireball's John Gruber suggests that Apple rejected Opera because the browser included its own JavaScript interpreter, something forbidden by the iPhone SDK developer agreement.

Opera makes two flavors of its mobile web browser: Opera Mini for most mobile phones, BlackBerry, Palm, or Windows Mobile; and Opera Mobile, a more featured version for Symbian and Windows Mobile. A beta version of Opera Mini for Android is also in development.

Update: Gruber used his massive Rolodex over the weekend to determine through an unnamed source that the app may not have even been submitted to the App Store. Huh.

Filed under: Software, Internet Tools, Open Source, TUAW Labs

Screaming fast Mozilla browser Minefield gives a glimpse of Firefox's future

MinefieldI was really disappointed when Google released their Chrome web browser for Windows only. When it comes to browsers, I've tried them all. Right now I regularly switch between Firefox and the latest nightly build from Webkit (essentially Safari). Firefox has the extensibility I rely on, while Webkit has the performance I crave. I had hoped that Chrome would magically combine those two crucial traits and become my new go-to browser. Unfortunately, Chrome is not yet nearly as extensible as Firefox, and isn't available for Mac (yet).

So imagine my surprise when I stumbled upon the latest experimental Firefox build from Mozilla, called Minefield. This Minefield should not be confused with the unofficial optimized builds of Firefox that Brett wrote about, which are also referred to as Minefield. Minefield is Mozilla's code-name for this generation of Firefox, and the code name is used for unofficial builds to avoid infringing upon the Firefox name.

So, what's so special about the Mozilla Minefield build? It's fast... smokin' fast. This is essentially a version of Firefox with the new TraceMonkey JavaScript engine under the hood, and as Ars Technica reports, it tests even faster than Google's V8 JavaScript engine.

As most Mac users have noted, Firefox is kind of pokey on the Mac platform, particularly compared with WebKit or even Safari, and even when compared with Firefox on a similarly spec'd Windows machine. Version 3 of Firefox was supposed to fix the performance problem, and while it's somewhat better, it's still not great.

Well, Minefield is great. Using Gmail or even a complex content management system is a breath of fresh air. I feel like my web apps are finally keeping up with me.

There's one caveat, and it's a big one: though the current version number is 3.1b2pre (the "b" denoting beta status), this is really alpha software. That means there will be bugs, and you will experience problems. Surprisingly, though, Minefield has been very stable in my testing -- not yet crashing in a full day of testing. I have restarted it a couple of times due to suspicion that something strange was going on, but I can't say for sure if it was.

If you use it with your regular Firefox profile rather than creating a new one, Minefield will complain that most of your extensions are not compatible. Using Nightly Tester Tools, I re-enabled all of the extensions that it disabled, and every single one of them appears to be working normally, even the complicated ones like Better Gmail 2 and TabMixPlus.

I've only had a problem with one site so far, but unfortunately it's a big one: Google Docs. The page simply won't load. But for now, I'm willing to open WebKit or Camino to edit my Google Docs, because I'm just too smitten with the raw speed that Minefield offers.

One last note: being a nightly build, you will likely find that new versions are available, well, nightly. Mozilla makes the process of upgrading to the latest version virtually painless by using the built-in version monitoring process that Firefox uses.

[via Ubuntu Unleashed]

Filed under: Developer

JSCocoa 1.0, write Cocoa apps in Javascript

Do you want to write Cocoa applications, but happen to be handier with Javascript than with Objective-C? JSCocoa to the rescue! Similar in concept to RubyCocoa, JSCocoa provides a bridge between Webkit's JavascriptCore and Cocoa, allowing you to call C and Objective-C code, as well as build Javascript classes which inherit from Objective-C classes.

Visit the Google Code page for a quickstart and some syntax explanations. JSCocoa is open source and available for subversion checkout or direct download.

Filed under: Internet Tools

Google creating its own browser based on WebKit


Google is developing a new web browser built from the ground up and based on WebKit, the same rendering engine that Safari uses.

The browser, called Chrome, is open-source software built with security, compatibility and speed in mind. Each tab in the browser will be its own separate running process. For example, if JavaScript hangs in one tab, the other tabs will remain unaffected. The approach is similar to the way Mac OS X isolates applications in their own private areas to prevent one crash from taking down the whole system.

Google picked an interesting way of announcing the project: They commissioned illustrator Scott McCloud to draw a 38-page comic book about the project, and distribute it under a Creative Commons license. The result is a very readable, fascinating way to learn about the new browser.

For web developers, Chrome will include strong Gears integration, and a JavaScript virtual machine that generates super-fast machine code out of JavaScript instructions. For end users, it will include a new start page that lists the last several pages and search terms you've used. It also includes a private browsing mode.

Google is planning on formally launching the project on Wednesday, but the Chrome website isn't visible to the public yet. Update: Google is releasing a version for Windows tomorrow, with Mac and Linux versions coming soon, once Chrome is "faster and more robust." (Thanks, Bryan!)

[Via Macworld]

Filed under: iLife, Internet, Internet Tools, Developer

Take back your iWeb galleries in Firefox 3


Just as Firefox users were upgrading to version 3 last week, many people started to miss their iWeb-created galleries as they just disappeared. Well, one iWeb user has been doing extra work to fix Apple's? (erm... Mozilla's?) problem. Joshua Ochs has posted an in-depth article on his site describing exactly what is going on -- he also provides a fix in the form of a script to patch iWeb.

Joshua says that the problem is neither with Apple nor Mozilla, but with a JavaScript library called "Prototype" which is used by iWeb. Right now there are two ways to fix the problem (neither of which are supported by Apple): you can use the information on Apple's Discussion Board, or you can download Joshua's script -- both seem to work and are free.

[via ArsTechnica]

Filed under: Internet Tools, Open Source, Apple, .Mac

New .Mac galleries leverage open source frameworks

The .Mac galleries got a lot of time today in Steve's presentation, and for good reason. Though I won't be dropping Flickr any time soon, the .Mac galleries are very cool looking and have some very nice features (the 'photo skimming' is a nice touch). It would seem that Apple leveraged some Open Source goodness in order to get these galleries up and running. According to the SproutIt blog Apple is using the SproutCore application framework, and has contributed back a number of enhancements to the project.

A quick peek at the code of a gallery confirms that Apple is using SproutCore (just search for sproutcore.js) as well as script.aculo.us (a set of open source javascript libraries that handle things like animation). If that's isn't Web 2.0 enough for you, I don't know what is.

Filed under: iPhone

iPhone bookmarklets

Over at LifeClever they had the in retrospect obvious, but nonetheless brilliant idea that you can use javascript bookmarkets with your iPhone. Bookmarklets are basically little bits of JavaScript that can perform various functions in your web browser. So, for instance, del.icio.us offers bookmarklets for posting links to their site. Anyway, LifeClever has put together a list of their 17 favorite bookmarklets for the iPhone.

These include a nice find text on this page bookmarklet, as well as others for searching on various sites, translating, YubNub, etc. These look pretty cool, and really do add some missing functionality to your iPhone.

Filed under: Internet Tools, iPhone

Experimental web app could bring AIM chat to iPhone

While the jury will of course be out until June 29th as to whether web-based chat apps like Meebo could be used on the iPhone to work around the lack of a true, built-in chat app, David Cann has developed an experimental web interface that might bring AIM to next week's highly-anticipated gadget. The service is up and running already, allowing users to log into AIM using Cann's page, but the adjective 'experimental' is used for a reason. First, it's suffering some rocky performance due, in part, to being dugg, but it's also based simply on some JavaScript that Cann is running with his own servers (while this might scare some privacy advocates, Cann promises users that he isn't harvesting any information or chats. Do with that what you will).

Cann's iChat for iPhone service, as it's called, is also fairly limited in functionality, at least for now; this definitely isn't your Mac's iChat. Right now there are no groups, no buddy icons and opening more than 4 chats apparently is not recommended. Usage is also limited to only 10 minutes per session also, probably to help Cann sleep at night while he's tinkering with polishing this.

Still, if at least some form of iChat is strongly desired or simply a necessity for some iPhone users, this iChat for iPhone could overcome the hurdle for at least a few potential customers. Of course, we're all expecting Apple to provide a more serious solution at some point, but as with so many other Apple-related offerings, we'll just have to play the waiting game.

Tip of the Day

F11 moves all your windows off the screen so you can quickly glance at your desktop. F10 shows you every open window in an application. F9 shows every open window for every application that isn't hidden or in the dock.


Follow us on Twitter!
 TUAW [Cafepress]

Featured Galleries

DNC Macs
Macworld 2008 Keynote
Macworld 2008 Build-up
Google Earth for iPhone
Podcaster
Storyist 2.0
AT&T Navigator Road Test
Bento for iPhone 1.0
Scrabble for iPhone
Tom Bihn Checkpoint Flyer Briefcase
Apple Vanity Plates
Apple booth Macworld 07
WorldVoice Radio
Quickoffice for iPhone 1.1.1
Daylite 3.9 Review
DiscPainter
Mariner Calc for iPhone
2009CupertinoBus
Crash Bandicoot Nitro Kart 3D
MLB.com At Bat 2009
Macworld Expo 2007 show floor

 

More Apple Analysis

AOL Radio TUAW on Stitcher