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.
Posted by Rostislav at 2:15 PM in SWFAddress
Comments:
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?
So that it executes only then?
Thanks in advance.
As far as I can see, setValue() only supports 1 method. And it's called equally from Flash and from the JavaScript.
Cheers.
It's easy to implement in your code and will probably become a new feature in the next SWFAddress release.
Both INTERNAL_CHANGE and EXTERNAL_CHANGE events are already implemented and the new version will be out very soon.
CHANGE
public static const CHANGE:String = "change"
Change event.
This is good but not enough to understand.
Thanx, great work
You wouldn't be a diamond and show us how to implement this in your code? Please?