ThemeForest

Trick for testing alternative content of your Flash website.

567 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Ireland
  • Referred between 10 and 49 users
  • Sold between 10 000 and 50 000 dollars
iamdok says

These days it’s good practice to create a html version of the Flash website that you develop for a client. At the very least this page should include the main menu links, the about text and some contact information. Doing so will imporve the SEO of the Flash site, while also providing some main content for those visitors who happed to be using an iPhone, iPad, or who’s Flash player version is too low for your content.

Anyway, when creating these pages and presenting them to the client it can be awkward to view the alternative content as the site will automatically lauch into the Flash content. The traditional way to get around this are to disable javascript or present the html page seperately, or just visit with your iDevice :D , but this is still awkward!

Perhaps you all know this already, but if not, I found this nice trick involving SWFObject where you set the SWFObject to check for a certain query string and embed the swf file only if said query string is not found in the page url. Then when you want to see the alternative content you just add this small query string on to the url and wham, you see the page from the iDevice point of view! Therefore you can quickly test the alternative content is working and you can easily send the site link including the query string to your client, so they can also see the page.

Anyway here is the code, which goes in the index.html file:


//import swfobject as normal

<script src="js/swfobject.js" type="text/javascript"></script>
<script type="text/javascript">

var vars = { "site flashvars here" };
var params = { "swfobject parameters here" };
var attributes = { "swfobject attributes here" }; 

//if else statement to check for query string

if (swfobject.getQueryParamValue("viewAlt") == "true") 
{ 
    //paste "?viewAlt=true" to the end of the browser url
    //and this will evaluate to true and skip embedding the swf
}
else
{
    //normal swfobject embed script here
    swfobject.embedSWF(....);
}

</script>

//end swf object code

So as you can read above, simply adding ?viewAlt=true to your Flash site url, will show you the alternative content. Nice one :)

See the original blog post by Partick McDonald.

Donagh

3593 posts
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Exclusive Author
  • Beta Tester
  • Has been a member for 3-4 years
  • Spain
+3 more
pezflash says

Nice tip. Thanks for the link! Bookmarked.

662 posts
  • Author had a Free File of the Month
  • Bought between 50 and 99 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 1 000 and 5 000 dollars
outandouter says

Useful tip. Thanks!

413 posts Fuel Your Web
  • Elite Author
  • Won a Competition
  • Sold between 100 000 and 250 000 dollars
  • Exclusive Author
  • Has been a member for 6-7 years
  • Bought between 10 and 49 items
  • Referred between 100 and 199 users
  • Europe
Pirenko says

Great stuff. I’ve searched for this some time ago. Thanks! :nerdy:

7473 posts
  • Attended a Community Meetup
  • Community Moderator
  • Has been a member for 5-6 years
  • United Kingdom
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Contributed a Blog Post
  • Beta Tester
  • Bought between 50 and 99 items
+4 more
MSFX moderator says

nice one, i’ve always edited the flash player version to be 100 lol :P

1607 posts
  • Author had a Free File of the Month
  • Microlancer Beta Tester
  • Beta Tester
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Referred between 1 and 9 users
+5 more
DaniMun says
nice one, i’ve always edited the flash player version to be 100 lol :P

lol, same here :D

Thanks for the tip Donagh! :bigwink:

by
by
by
by
by