# Will this code work to replace alternate content with a SWF?

**URL:** https://forum.kirupa.com/t/will-this-code-work-to-replace-alternate-content-with-a-swf/327082
**Category:** web dev
**Created:** [February 4, 2012, 1:30pm UTC](https://forum.kirupa.com/t/will-this-code-work-to-replace-alternate-content-with-a-swf/327082 "2012-02-04T13:30:19Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![m2244](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@m2244](https://forum.kirupa.com/u/m2244)
#### Post date: [February 4, 2012, 1:30pm UTC](https://forum.kirupa.com/t/will-this-code-work-to-replace-alternate-content-with-a-swf/327082/1 "2012-02-04T13:30:19Z")

</div>

Hello,

I am trying to show alternate content to the user if they don’t have Flash player. Will this work?

The HTML code.

```auto

<script type="text/javascript"> 
loadSwfToDiv("c2/data/sld10.swf", "c2",600,500)
</script> 

<div id="c2"><img src="images/sunset.jpg"></div>

```

The external JS code.

```auto

function loadSwfToDiv(swf_url, div_id, ww, hh)
{
 var flashvars = {};
 var params = {};
 params.wmode = "transparent";
 var attributes = {};
 swfobject.embedSWF(swf_url, div_id, ww , hh, "9.0.0", false, flashvars, params, attributes);
}

```
