Don’t let Google fool you; tame your Flash!

As I wrote some time ago, Google indeed does index Flash. Great? Well, maybe not: you might even lose valuable site visits this way! This is because Google does not direct users to the page on your site that contains the Flash (as it does for image search results), but to the standalone SWF-file. That means that people doing a normal search in Google, will in some circumstances get high-ranking links straight to your Flash-files instead of to your website and that these prospects will not be drawn into your website’s sales funnel at all. So much for SEO.

Solutions? Well, you could refrain from using Flash all together, there’s too much of that stuff around anyhow. Or you could prohibit googlebot (and others) from indexing swf-files by specifying this in your robots.txt-file.

These are both great remedies, but somehow I think not everyone will agree. So what if we could perform some ActionScript-magic to make a Flash-file force itself in its correct context? Although I am not a (Flash-)developer by any account, I hacked together a small demo (in ActionScript 2) to show how that could be done.

And indeed, if you point your browser to the standalone swf-file, you’ll see you are redirected to this page. How this is accomplished? Quite easily actually;

  1. add a flashvar (e.g. “embedded=true”) to the object/embed tags in the html
  2. check for the value of that flashvar in the first frame of your movie:
    var embedTrue=_root.embedded;
    if (embedTrue=="true") {
         // all normal flashyness goes here
         stop();
    }
    else {
         gotoAndPlay(2);
         stop();
    }
  3. and in frame 2 we do the redirect to the correct url:
    onEnterFrame = function() {
    // weird, stupid test to avoid this from being executed more than once
    if (!runOnce) {
    		var targetUrl = "http://blog.futtta.be/2008/05/06/";
    		geturl(targetUrl);
    		runOnce="1";
    	}
    }
    stop();

I’m sure the code stinks and it indeed is only actionscript2 and not 3, but maybe someone out there can build something usefull out of this general idea. And if not, I’ve had fun learning some (very) basic actionscripting. Now off to “Add/remove software” to get rid of that hog of an IDE! :-)

2 thoughts on “Don’t let Google fool you; tame your Flash!

  1. SlowMo

    Imho it shouldn’t be hard for evil google to keep track of the object/embed tags as well.. And then they’d still be able to show you the flash, without your site.

    Next thing you know, you’ll be adding object/embed tags with 1024bit hashes, to make sure the flash is shown on your site.

    Reply
  2. frank Post author

    i think it’s highly unlikely that google would ever go down that path, because;
    * google embedding flash in their pages would offer no advantages to google or to the user.
    * it would mean a change in the google interface, they’re very conservative as far as their GUI is concerned.
    * if they would want to change the way they show flash-results, they’ll sooner do it the way they do for images (show image in a frame and the context in a larger frame below that one)
    * there are other ways to do this besides flashvars. having your flash contact a serverside app would be the first thing i would look into.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *