Article

Accessible Flash Parts 1 And 2

Page: 1 2 3 4 5 6 Next

Serendipity - Bookmarking

Yes! Bookmarking a Flash Website for direct return is possible. With the SEO solution we discussed in the first part of this article, once each piece of content was loaded into the Flash movie it could be identified via a unique id. And, with a bit of Flash -- JavaScript interaction, I could provide a link to allow visitors to bookmark the content that was currently visible.

Internet Explorer 4+ for Windows allows a bookmark URL to be written to it using a little IE specific Javascript. Browsers such as Mozilla, Opera, and basically anything that's not IE for Windows, do not allow this functionality, for some commonsense security reasons.

Flash can communicate with JavaScript if we add a function call into an HTML hyperlink and store this anchor in the content that's retrieved. Here's the ActionScript, and code for the hyperlink:

bkurl = "http://www.webqs.com/?go=" + contentDisplay.id;    
bktitle = "webqs.com : " + contentDisplay.header;    
<a href=\"javascript:setBookmark(bkurl, bktitle)\">bookmark      
this content</a>

Simple! When clicked in Flash, this dials up a JavaScript function called "setBookmark" that can be placed in the <head> tags of the HTML page in question:

<script type="text/javascript">    
<!--    
   function setBookmark(url,pagetitle)    
   //function performs the bookmark action    
   {    
           //code for IE4+ on win32    
           if (navigator.appName == "Microsoft      
Internet Explorer" && navigator.appVersion >= "4.0" &&      
navigator.platform == "Win32")    
           {    
                         window.external.AddFavorite(url, pagetitle);    
           }    
           //this code posts a prompt if not    
           else    
           {    
                         window.prompt('Hit Ctrl-Shift-D      
(Command-D on a Mac, Ctrl-T in Opera) to bookmark this      
page.\nCopy and paste this address and title for the      
bookmark :' , url + '  ' + pagetitle);    
           }    
// -->    
</script>

Note that, when compared to standard HTML pages, this method has the big disadvantage that the Website visitor can't simply hit their bookmark keystrokes to store the URL for the current content (unless it is the URL for the content requested). Why not? Because, whenever new content is requested inside a Flash movie, the URL stays the same throughout the process -- it doesn't change to reflect the updated content.

Alternative -- What if I Don't Have a Database?

The method described above for having Flash content indexed by search engines is based on the assumption that we're using a database as the storage medium. So, what happens if your content is stored in a plain text file or embedded in the actual Flash movie?

Retrieving content from plain text files with PHP is a simple task that uses the language's built in filesystem functions. Simply put all the content in an array, using the file() function, then traverse the array and print out each element. To match the text files with what has been entered in the URL, we must use a naming system such as 1.txt, 2.txt etc. Instead of SELECTing data from the database table using the value of $go, you could target a '$go.txt' file for reading and printing to the screen.

If, for some reason, you have embedded text in the Flash movie, then make a copy of what has been embedded and place it in text files. It can then be retrieved using the method above. You will find that this has te done every time the Flash content is updated, so it may be wise to think about migrating to a text file, XML file or database to store the content.

Advantages

Just the fact that search engines can index the most up-to-date Flash content on a site, without having to manually update the search engine content, is a huge boost to the accessibility of Flash Websites.

Furthermore, our clients, and we as developers, see the tangible benefits of a Flash Website achieving a good rank in the search engine listings, based on actual site content.

Your clients may also be interested in understanding which areas of content are more popular. Most log file analysers will recognise filenames with query strings as independent files. And, as such, we can provide our client with the relevant numbers and further tailor site content based on those results.

Most importantly, prospective clients can be informed that, yes, a Flash Website can be indexed by search engines -- without seriously increasing the project's cost.

Disadvantages

In diverting searchbots to plain text content, it's worth noting that this system relies on your keeping the stored list of bots up to date and accurate, which is possibly the solution's biggest weakness.

Of course, this issue's not a script-breaker, as any bot that slips through the filtering will simply find the HTML tags that hold the Flash movie. It's up to the developer, though, to keep this list up to date -- just as other Webmasters use a robot.txt file to exclude certain bots from visiting their Website.

If you liked this article, share the love:
Print-Friendly Version Suggest an Article