Safari deep linking now available in UrlKit 0.60
October 19, 2006 on 6:56 pm | In Flex, Programming | No CommentsAfter a couple of painful days of hacking JavaScript, Safari is now supported by UrlKit 0.60. Back/forward and bookmarking of Flex URLs now more or less works in Safari 2. Check out the sample app!
The 4 required incantations were:
- construct an inner-HTML form whose action is the #-identifier for the state, and submit it programmatically; this seems to be required in order to get Safari to add the navigation to its browser history. It’s not necessary or sufficient to change the location hash or to write an anchor into the page. (Thanks to David Bloom for publishing this tidbit.)
- poll history.length in a timer to see when back/forward has been pressed
- track an array of app state identifiers in an array indexed by history.length, since document.location.hash does not actually update when back/forward are used.
- do not wrap the <embed> tag inside an <object> tag, as seen in numerous examples of including Flash objects in the page for IE/FF.
I’ve also externalized all of the JavaScript into a single urlkit.js file to make it easier to hack the JavaScript when working on different browsers.
There remain a few minor Safari issues to be mopped up (mostly relating to the third point above), but I wanted to get this release out there as a demonstration that Safari 2 support is entirely feasible.
Of course, IE 7 would come out just now. I haven’t had time to look at that yet!
No Comments yet »
RSS feed for comments on this post. TrackBack URI
Leave a comment
Entries and comments feeds.
Valid XHTML and CSS.
All content copyright (c) 2006-2007 Joseph Berkovitz. All Rights Reserved.