Asual

Friday,
18 May 2007

SWFAddress bad practices

As the number of SWFAddress powered sites grows I often see problems caused by poor implementations or lack of information. Here is a list of the top 5 practices which should be avoided:

Usage of getURL() for user tracking, statistics and popups
While this is a standard Flash functionality used for years, the combination with ExternalInterface introduces a critical bug with Internet Explorer. The resolution is to use ExternalInterface for every JavaScript call. SWFAddress 2.0 will help you with some predefined methods for popups and blank window links.
Homepage address values like '#Home' or '#/root'
Such address values are not needed and should be replaced by SWFAddress.setValue('/'). The usage of http://domain.com/#home creates an unneeded history entry when http://domain.com is opened.
Address values naming using camelCase or other forms of custom convention
SWFAddress samples clearly define the best naming convention for deep links. Web addresses are case insensitive and the standard is lower case. For readability and Google SEO compatibility reasons the convention 'my-deep-link' is more appropriate than 'myDeepLink' or 'My_deep_link'. The format http://domain.com/#/my-deep-link/?param=value is the only one fully compatible with the SWFAddress SEO rewriting.
Including SWFAddress before the TITLE tag
SWFAddress contains a fix for Internet Explorer and URLs which contain anchors. In order to benefit from it the title tag should be printed before the swfaddress.js include.
Duplication of navigation logic

Integration of SWFAddress into a legacy code may require the following implementation:

For brand new projects, the best way to organize your code looks like this:

Update: The post has been updated for SWFAddress 2.0.

« Previous Post | Next Post »

Comments:

Left by Rostislav at Mon, 19 Apr 4:15 PM
@Ryan
The hyphen is good for indexing because Google treats it like a space. Since it's a string so far I haven't seen any problems with it. If you want to map deep links to instance names then probably you can replace it with an underscore?
Left by Tim at Mon, 19 Apr 4:15 PM
So no one has solution for finding out whether the onChange was fired from the browser originally or not?
Left by Psilos at Mon, 19 Apr 4:15 PM
How can I find out if eventIsCalledFromTheBrowser?
So that it executes only then?

Thanks in advance.
Left by insanegman at Mon, 19 Apr 4:15 PM
I too would like to know how to differentiate the source of the setValue event dispatch. Some boolean like "eventFromBrowser" would be adequate.
Left by molamil at Mon, 19 Apr 4:15 PM
Yup, I have the same issue - I'd need to somehow differentiate the setValue() calls from Flash and from the Browser.

As far as I can see, setValue() only supports 1 method. And it's called equally from Flash and from the JavaScript.

Cheers.
Left by Ryan at Mon, 19 Apr 4:15 PM
Althought I appreciate the whole SEO thing, using "-" within Actionscript is just a bit of a pain since it's an operator. Any suggestions for this issue?
Left by Rostislav at Mon, 19 Apr 4:15 PM
@Tim
It's easy to implement in your code and will probably become a new feature in the next SWFAddress release.
Left by Rostislav Hristov at Mon, 19 Apr 4:15 PM
@Pete

Both INTERNAL_CHANGE and EXTERNAL_CHANGE events are already implemented and the new version will be out very soon.
Left by jeff at Mon, 19 Apr 4:15 PM
For some reason whenever I'm navigating through selections quickly using firefox on my mac. There is a strange behavior where the page navigation will bounce undesirably between the two pages i clicked on before settling on the appropriate page. I thought it was my implementation of navigation logic, but this is also apparent in the CS3 sample listed on this site. Of course it only occurs when clicking back and forth quicktly.
Left by Adrian at Mon, 19 Apr 4:15 PM
Could you add some in-depth explanation for the methods, properties and events, please ?
CHANGE
public static const CHANGE:String = "change"
Change event.

This is good but not enough to understand.
Thanx, great work
Left by Pete at Mon, 19 Apr 4:15 PM
@Rostislav

You wouldn't be a diamond and show us how to implement this in your code? Please?
Left by gabs at Thu, 24 Mar 11:27 AM
"Homepage address values like '#Home' or '#/root' - Such address values are not needed and should be replaced by SWFAddress.setValue('/'). The usage of http://domain.com/#home creates an unneeded history entry when http://domain.com is opened."

I have had a website up for about 6 months with this bad practice in place. It was fixed a month ago and I'm seeing a sensible change in the ratio vists vs vistors in google analytics. Before the fix, visits were tracked at more than double the amount of visitors, after the fix visits have dropped sensibly while visitors have maintained a value consistent with the past.

Can this anomaly be attributed to this bad practice? Has anyone had similar issues?
Thanks!
Left by Marcus at Sun, 16 Sep 8:25 AM
I want to send you an award for most helpful itrneent writer.

Projects

Syndication

Blog Search

Blog Categories

Blog posts

Recommended sites