Web Development

Scriptaculous + JS optimizations can cause problems

Tags: 

With everyone raving about YSlow I used it to prune a new project I was doing. Well, after the results worked just great with Safari and Firefox I was thoroughly confused why it wasn't working correctly in IE. The problem was that my Script.aculo.us routines weren't working, and more specifically I was getting really weird errors when the page was loading, before any of the routines executed. Some of the errors were very vague, e.g. "'Class' is undefined", and "Effect.toggle is undefined". Well after lots of kicking around I finally tried something - I removed the defer="defer" attributes off the JS calls and it magically started working! Go figure! So, at the end of the day the lesson is that if you are using Script.aculo.us you can't use defer="defer" on your Prototype.js call, otherwise visitors using IE will be greated with a whole bunch of error messages and nothing will work.

Tip: Passing a shopping cart to Paypal Website Payments Standard

Tags: 

Here's a little tip for anyone using Paypal's Website Payments Standard system for electronic payments on their shopping cart. Their API allows you to pass in a complete shopping cart using a series of form fields listing the items, quantities, etc, as you'd expect. There's one tiny little detail that isn't explicitly stated - the button that you use to submit to the API must not have a name attribute otherwise it will fail. Here's a fully working example to better explain:
[source:html]












[/source]
As you can see there's no name attribute on the submit button, just an id.

Details for iPhone web app development (UPDATED)

Tags: 

Some details have been made available by The University of Washington on how to develop web applications for iPhone - lots of basics in there, like keeping a good separation of HTML and CSS, but also some specifics on e.g. the screen width, some limitations in place, etc. Mandatory reading for anyone doing iPhone apps.

UPDATE: Apparently someone didn't like the info being posted publically, so someone posted a copy of the iPhone details elsewhere.

button_to HTML options not completely intuitive

Tags: 

While working on a site in Rails tonight I was adding a button_to that I wanted a JS confirmation requester. Well, based on my albeit beginner knowledge of Rails I thought the following would work:
[source:ruby]
:empty, :confirm => "Really empty your cart?" %>
[/source]
As it turned out this wouldn't work, it kept adding "?confirm=Really empty your cart?" to the URL instead of doing a popup. A bit of fiddling later I realized that to work correctly the additional arguments to button_to need to be arrays, e.g.:
[source:ruby]
:empty}, {:confirm => "Really empty your cart?"} %>
[/source]

Pages

Subscribe to Web Development