# Swfaddress-optimizer.js

**URL:** https://forum.kirupa.com/t/swfaddress-optimizer-js/293205
**Category:** Uncategorized
**Created:** [July 24, 2009, 8:59pm UTC](https://forum.kirupa.com/t/swfaddress-optimizer-js/293205 "2009-07-24T20:59:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![willfaulds](https://avatars.discourse-cdn.com/v4/letter/w/e47c2d/32.png) [@willfaulds](https://forum.kirupa.com/u/willfaulds)
#### Post date: [July 24, 2009, 8:59pm UTC](https://forum.kirupa.com/t/swfaddress-optimizer-js/293205/1 "2009-07-24T20:59:44Z")

</div>

I hope someone can help me decipher the purpose of the swfaddress-optimizer.js

As I understand it is responsible for the redirects (to the swfaddressed # version if you landed on the non-# version but have flash and vice versa). Please tell me if it does more or if I’m totally wrong.

I am trying to add a user preference to the swfaddress functionality. So a user may choose to view plain html is they prefer. The choice is stored in a cookie. That is checked by the js function isCookie. This all works BUT I can’t figure out how to use the swfaddress-optimizer.js as if flash is disabled. I thought I might get away with setting an impossibly high version requirement (see “?flash=99” below) but that doesn’t seem to work…

Below is a sample from a template file which is published via php (the [@tag]'s are replaced by the php script).

```auto
if (isCookie("flash")) {
    //goto swfAddress url
    document.write('<script src="[@js_url]swfaddress-optimizer.js?flash=[@flash_version]&amp;swfaddress=[@deeplink_url]&amp;base=[@base_url]" type="text/JavaScript"><\/script>');
} else {
    //goto NON-swfAddress url
    document.write('<script src="[@js_url]swfaddress-optimizer.js?flash=99&amp;swfaddress=[@deeplink_url]&amp;base=[@base_url]" type="text/JavaScript"><\/script>');
}

```

As I have worked out so far; The swfaddress-optimizer.js takes 3 queries

flash = Number (required flash version)  
swfaddress = String (url after #)  
base = String (desired url before #)

Any ideas?
