Wednesday, August 17, 2005
AJAX: Notes on Detecting History Changes in Safari
I've been experimenting with how to get back and forward buttons and bookmarkability for AJAX apps in Safari. No one has been able to get Safari to work with any known hack for detecting if the user has touched the back or forward buttons in an AJAX app, or getting bookmarkability to work. Here are some of my notes from playing around today with Safari at a rental shop:
- You can indeed see through document.location.href and document.location.hash that there is a hash value, such as "#helloworld". However, if you change the browser location with a hash, such as "document.location.href = '#helloworld'", you have to have a timeout of about 200 milliseconds to see the change (i.e. if you immediately call alert(document.location.href) right after changing the location you won't see the change).
- iframes and programmatic anchor changes are not in the history; however, if I create real links on the pages with anchors in them and click these with a mouse then they ARE in the history.
- Dynamically writing into an iframe (i.e. myIframe.contentDocument.write) is NOT in the history
- I've been experimenting with framesets to see how they behave in Safari for AJAX history and bookmarks. If I have two frames, where one is hidden, and change its location with a hash, then the history is recorded BUT hitting the back and forward buttons doesn't change the address in the hidden frame. HOWEVER, if I change the search value (i.e. document.location.search) then it IS saved in history AND changes with the back and forward buttons! Even better, this works from programmatic control (i.e. I am changing these values programmatically rather than through a user clicking on actual hyperlinks).
- Wierdly enough, now I'm NOT getting the behavior above in Safari, so frames don't seem to hold their history.... sigh... Safari sucks.
Emulating SVG and Safari's Canvas on Internet Explorer
This might be completely off the mark, but might it be possible to emulate a subset of Scalable Vector Graphics (SVG) or Safari's Canvas tag on Internet Explorer using IE's proprietary Vector Markup Language (VML) format? I don't know VML in-depth enough to know if it supports what is necessary for a subset of
Some details on VML:
canvas
or SVG, but it would certainly be a fun exercise to try to figure it out. If it is possible to emulate part of SVG or canvas with it, this means that canvas and SVG could be used in cross browser apps since both SVG+canvas will be in Mozilla 1.1, canvas is in Safari, and IE would have a VML shim to provide canvas or SVG support.Some details on VML:
- "The Vector Markup Language (Part I)"
- "Examples of VML"
- "VML: Vector Markup Language"
- "VML: A lost graphical markup language"
Subscribe to Posts [Atom]