# Inserting your SWF with Javascript

**URL:** <https://forum.kirupa.com/t/inserting-your-swf-with-javascript/284922>\
**Category:** Uncategorized\
**Created:** [March 25, 2009, 5:02am UTC](https://forum.kirupa.com/t/inserting-your-swf-with-javascript/284922 "2009-03-25T05:02:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cookingkym](https://avatars.discourse-cdn.com/v4/letter/c/bc79bd/32.png) [@cookingkym](https://forum.kirupa.com/u/cookingkym)\
**Post date:** [March 25, 2009, 5:02am UTC](https://forum.kirupa.com/t/inserting-your-swf-with-javascript/284922/1 "2009-03-25T05:02:33Z")

</div>

Hey Kirupa

Does anyone know the theory behind using javascript to insert your SWF files into the XHTML page, rather then the ("Insert…, Media…, SWF) way.

Is this a better way of doing it? whats the difference?

the Java looks like this:

\<script type=“text/javascript”\>  
A[  
var so = new SWFObject(“here.swf”, “”, “100%”, “100%”, “9”, “#000000”);  
so.addParam(“scale”, “noscale”);  
so.addParam(“salign”, “tl”);  
so.addParam(“wmode”,“opaque”);  
so.write(“flash”);

\</script\>

Also what is this script used for:

\<script type=“text/javascript”\>  
var gaJsHost = ((“https:” == document.location.protocol) ? “[https://ssl](https://ssl).” : “[http://www](http://www).”);  
document.write(unescape("%3Cscript src=’" + gaJsHost + “[google-analytics.com/ga.js](http://google-analytics.com/ga.js)’ type=‘text/javascript’%3E%3C/script%3E”));  
\</script\>

I keep seeing this around.

Thank for your time

kym
