Monday, February 04, 2008

Linking out of Flash embedded on MySpace, et. al.

Don't get your hopes up - you can't link directly from a Flash object in MySpace (Bebo, Facebook, etc.) or any other profile site that adds allowScriptAccess="never" to your embed code.
But what if you want to create a link in a Flash widget that works when it can (like, on a blog), but display the URL and a "copy to clipboard" button when it can't (on MySpace)? This way, you don't have to force a user to choose between the version that links properly and one that doesn't (risking that the click-through-rate will be lower on the fallback solution.)

Here is the best way to detect the linking limitation, cross-browser:
  1. Make sure your embed code has allowScriptAccess set to "always" (it defaults to "sameDomain"). Be sure this is specified as an object-tag parameter as well as a param-tag name-value pair. MySpace will convert this to "never" properly.
  2. In ActionScript, call"eval", "window.location.href = '[full url]';")
  3. The method only works when allowScriptAccess is "always", otherwise it returns null, so check for that.
  4. If null is in fact returned, implement your fallback strategy (such as the one mentioned above.)
Don't waste your time with shenanigans involving and pop-ups either — some pop-up blockers don't take clicks sent to embedded objects into account when determining whether a was generated from a user-initiated event.


Post a Comment

<< Home