Deep Linking:Restore State of Flex Application

Dear Dummy Friends,

I know I have been keeping quite tight lipped for a long time and the reason for that is either I didn’t have anything to say or whatever I wanted to say was not coming out pretty well. However, when I discovered this feature I really hit myself on the head for not having read the documentation thoroughly before and felt an urgent need of sharing it with you guys.

Have you ever wondered why flex application couldn’t be started from the last state that user closed the browser in?

Prepare to be liberated. Flex supports a feature called deep linking.

What is deep linking?

Deep linking is a method of making the flash application aware of the browser url and vice versa.

The first thing that we learn while writing flex application is that there is no need to navigate over pages in browser while using a flashplayer based applications. So, it is often miconstrued that flashplayer or the flex framework shouldn’t or doesn’t care about to providing any bridge between the state of the application and the state of the browser.

It is quite natural to believe that and treat it to be a constraint while developing flex applications. However, the truth is that flex framework does care about this comaptibility between the browser navigation and in-flex navigation. And you can see it by looking at the elaborate API the flex framework offers. [Article: Deep Linking in Flex,LiveDocs: About Deep Linking]

Advantage

This feature will add more of a backward compatibility for the old-school browser dependent generation that still thinks it is cool to navigate using only the back-forward buttons. I might add that I belong to that school of thought too.

A Cool Use Case

Apart from navigation it allows you to bookmark certain screens in a flex application. So that might actually be a cool feature to be used in application that provide iPaper like functionality. Say you were reading a book online on Scribd or any equivalent site. And suddenly you have to leave but you don’t want to leave your computer on and would rather have it turned off. Yet you sill want to be able to come back to the same page you were reading on the eBook. The flex based eBooks can support bookmarking to give it a real life feel.

Caution

Restoring the state only applies to the visible part of the application not to the other hidden portions of the application. Which means there should be some extra effort put in to ensure that the browser dependent navigation can be accurately captured and that it triggers all the state restoration in the same manner as if the application was going through its normal flow.

Before you leave!

There are various pitfalls in using this feature, so I would recommend strongly that you read the docs thoroughly and weigh the advantages over disadvantages before you support browser navigation.

Point to be noted

Good application only differs from average application in terms of setting the right expectations and meeting them consistently.

Happy Coding!

:)