In web-applications sometimes (if you try to do things good then always) it is needed to support browser navigation (back, forward buttons, bookmarks) and deep-linking.
This kind of requirements is not that hard to implement like it might seem. All you need to do in most of cases is to support switching to different states of your app by direct URLs. You just adds additional parameters to the URL pointing to the outer HTML page.
I’ve spent few hours yesterday to research in Flex documentation what weapons Flex provides for deep-linking. Everything appears to be very nice and elegant there.
Flex provides IBrowserManager interface and BrowserManager class which you use to handle deep-linking and communication with browser. Behind the scenes it employs History.css, History.js and some other files to work via JavaScript capabilities with different types of browsers.
Also URLUtil class will be handy. It’s equipped with methods allowing you quickly translate additional parameters you have in the URL to the object and vice verse to make it easier for you to work with those parameters.
I’ve tried to do some kind of a PoC and integrated this thing to one module of my current application and it perfectly worked with IE7 and FF3. What we were able to see after just some 1.5 hours of work is:
- ability to go by URL directly to the details page while without deeplinking it was always needed to go first to the list page
- ability to use back and forward browser buttons. History was nicely supported.
- ability to bookmark the pages
Though, some people have impression that standard Flex framework do not nicely support deep-linking. This can have few possible explanations as I think:
- some guys started to work with Flex quite long time ago when it was Flex 2. Those times as I understood people employed HistoryManager class to get history supported. And seems it didn’t worked properly with all browsers. Now Adobe says you need only use HistoryManager with Flex 2 and normally you must use BrowserManager.
- If you run your application from the Flex Builder under IE it uses local file system URI and underlying java script works incorrectly in this case. In FF you have no troubles even with local file system URI. This problem has quite nice solution. Use as a compilation target folder for your SWFs some folder under Apache htdocs or some other simple web-server so you can access your app in IE browser via normal http URL. After this you will be able to test deeplinking features under IE.
That’s all. It proved to me that BrowserManager and related features are reliable and can be used.
If you need full overview of deep-linking in Adobe Flex implementation then go here: Deep Linking.
Recent Comments