Making Flash websites search engine friendly

In my daytime job I’m a Flash developer. But when it comes to creating websites I don’t think Flash is the way to go. Not just because Flash has some serious accessibility issues, but mainly because Flash-only websites are very search engine unfriendly. They usually consist of only one HTML page, and most of those contain no readable content. So Google, MSN and Yahoo will have no clue as to what your site’s about. I’ve been pondering things you could do to fix or at least improve this. I’ve played around with a few of these ideas and techniques, others are still on my to-try list. Please let me know if you’ve come up with other solutions or have anything else to add.
1. Use SWFObject.
Geoff Stearns’ SWFObject is the way of embedding Flash movies into HTML pages. It’s only drawback is that it uses Javascript, but in return you get the best plugin detection that (no) money can buy, a fix for the Internet Explorer activation issue and the ability to add HTML content in a placeholder div for search engines and people with no Flash player installed. Put a short summary of what your site about (make sure you use plenty of keywords), along with contact details in there. That way, Google will a least find something it can read.
2. Accomodate deeplinking
Through a bit of PHP(*) and actionscript you can make sure anyone calling up www.yoursite.com/index.php?page=contact is taken to the contact ‘page’ in your flash movie. For a simple timeline-based Flash website the actionscript needed can be as simple as:
if( page != undefined ){
gotoAndStop(page);
}
If your movie has a key frame labelled ‘contact’, it will be shown.

For this to work you need to use PHP to tranfer the ‘page’ url variable into a flashvar. With SWFObject, the javascript code needed in the page will look something like this:
var so = new SWFObject("movie.swf", "mymovie", "200", "100", "7", "#336699");
so.addVariable("page", <?php echo $_GET['page']; ?>);
so.write(”flashcontent”);
Besides the obvious advantage of being able to send someone a link to a specific page, this also allows you to use a Google sitemap. Make sure you include a ‘menu’ listing of these links in the placeholder content so search engine bots can follow them.
A variation to this approach might be to create copies of your index.html with descriptive name like ‘about.html’. These can have different placeholder content but load the same Flash movie. No need for PHP, just add the right flashvar to have the movie skip to the right page. Obviously, this approach is best suited for small websites with only a limited number of pages.
* = Or any other server side programming language. Javascript probably has a few tricks up it’s sleeve as well.
3. Google sitemaps
A Google sitemap is an XML document that you place in your site’s root folder that contains the layout of your site. Google’s indexing mechanism will use this info to index every page on your site. You can simply put the “?page=something” links in there, and each page will be indexed. Especially for large websites, this could be an ideal way to make sure all your pages are spidered. Without having to link to every single one from the placeholder HTML.
4. Dynamic placeholder content
With the tweaks covered so far, each ‘page’ of your website will still have the same placeholder content. Whatever you chose to put in the SWFObject placeholder div. The trick now seems to be to generate a page with placeholder content that matches the content of the page the Flash movie will (initially) display. If you’re using something like “?page=about” in your URL, your movie will load(*) and display the about page. From then on, the user can navigate the site, but the placeholder text won’t change. This is not a problem, as search engine bots will not do this and the sitemap will ensure all of the URLs are called. So all we need to do now is create a script that inserts the “about” page content formatted as HTML into the page’s placeholder div.
If you’re using a CMS type solution, this might turn out to be quite easy. Instead of just generating XML for Flash to read, output that same content as simple <p>’s and <ul>’s and insert that into the page. For static websites this can be a bit of work, as all content needs to be maintained in the movie (or the XML files it loads) and in the PHP code. But if you’re serious about ranking well in search engines, it’s probably well worth the effort.
I’m not sure if Google will like this, any type of dynamic placeholder content might be considered ‘cloaking‘. Your best bet is probably to have the Flash content and the placeholder content match exactly.
* = Most Flash websites I’ve worked load XML data either from disk or through something like SOAP or Flash Remoting on a per-page basis.
5. Adding internal links to the placeholder content
Google sitemaps are great, but unless you create a script to do this for you, updating them can be a lot of work. A more practical solution could be to convert the internal links used in your Flash project into HTML. I’ve built numerous Flash projects that use a single XML document to describe each page. A link from one page to another might look something like:
<next>page2.xml</next>
This tells my Flash movie to load page2.xml when the next button is clicked. If your project uses a similar setup, it shouldn’t be too hard to translate this into:
<a href="index.php?page=page2">next</a>
If you succeed in adding links from your XML source as regular HTML links, your site will be truly indexable. In fact, you’ve now created a working HTML version of your website inside SWFObject’s placeholder div.
6. To the extreme: HTML style page refreshes
Since we’re now using HTML content in the placeholder div, search engine spiders will follow the links in that content and truly spider your website. One further step you could take is to use the same links inside your Flash movie. So if you’re on the about page, and the user clicks on your ‘contact’ button, use actionscript’s getURL command to get index.php?page=contact.
contact_btn.onRelease = function(){
getURL( "index.php?page=contact" );
}
This will cause an old-fashioned page refresh, but it will also update the address bar so people can bookmark all the pages in your site. The Flash movie itself will be cached by the browser, so page load times should be minimal. If you need to maintain user info from page to page, a local shared object is probably your best bet.
There’s also a way to update the address bar through javascript, but I wonder if that works on all browsers and whether it allows for bookmarking. If you can live with the page refreshes, this seems to be the best option.
Conclusion
I haven’t tested all of these approaches myself, and I’m definitely not an SEO expert. But I feel pretty confident that having dynamic placeholder texts that make your website indexable for search engine spiders, along with unique URLs for pages in your website will improve your site’s rankings dramatically. Like with AJAX it’s a question of prioritizing presentation and SEO for your website. Flash is unrivalled when it comes to creating visually exciting websites, but its troublesome to get Flash websites to be accessible and indexable. If you do decide you want to go with Flash, these tips might just help your audience find you.
Random Posts
Loading…










Leave a Reply
You must be logged in to post a comment.