title: Using document.write with an <object>
body: <p>The code below works as is. I want to use this code to display specific Twitch streams based on the page that is loaded.    </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      var stream = location.pathname;
      switch (stream) {
         case "/defatank":
            document.write("Defatank's Live Stream Page");
            break;
         case "/seeingblue":
            document.write("SeeingBlue's Live Stream Page");
            break;
         case "/shiroshii":
            document.write("Shiroshii's Live Stream Page");
            break;
         case "/theend66":
            document.write("TheEnd66's Live Stream Page");
            break;
         case "/wakawaka647":
            document.write("WakaWaka647's Live Stream Page");
            break;
         case "/xtheguythatplays":
            document.write("XTheGuyThatPlays' Live Stream Page");
            break;
      }
      &lt;/script&gt;
  </code></pre>
  
  <p>When I try to replace </p>
  
  <blockquote>
    <p>"Defatank's Live Stream Page"</p>
  </blockquote>
  
  <p>with the object below it doesn't work and breaks the rest of the cases.</p>
  
  <pre><code>&lt;object type="application/x-shockwave-flash" height="378" width="620" id="live_embed_player_flash" data="http://www.twitch.tv/widgets/live_embed_player.swf?channel=defatank" bgcolor="#000000"&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;param name="allowNetworking" value="all" /&gt;&lt;param name="movie" value="http://www.twitch.tv/widgets/live_embed_player.swf" /&gt;&lt;param name="flashvars" value="hostname=www.twitch.tv&amp;channel=defatank&amp;auto_play=true&amp;start_volume=25" /&gt;&lt;/object&gt;
  </code></pre>
  
  <p>I'm sure I'm probably using document.write wrongly or should be using something entirely different. Any suggestions?</p>
  
  <p>EDIT:
  Here is what the finished product looks like.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      var stream = location.pathname;
      switch (stream) {
         case "/defatank":
            document.write("&lt;object type="application/x-shockwave-flash" height="378" width="620" id="live_embed_player_flash" data="http://www.twitch.tv/widgets/live_embed_player.swf?channel=defatank" bgcolor="#000000"&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;param name="allowNetworking" value="all" /&gt;&lt;param name="movie" value="http://www.twitch.tv/widgets/live_embed_player.swf" /&gt;&lt;param name="flashvars" value="hostname=www.twitch.tv&amp;channel=defatank&amp;auto_play=true&amp;start_volume=25" /&gt;&lt;/object&gt;");
            break;
         case "/seeingblue":
            document.write("SeeingBlue's Live Stream Page");
            break;
         case "/shiroshii":
            document.write("Shiroshii's Live Stream Page");
            break;
         case "/theend66":
            document.write("TheEnd66's Live Stream Page");
            break;
         case "/wakawaka647":
            document.write("WakaWaka647's Live Stream Page");
            break;
         case "/xtheguythatplays":
            document.write("XTheGuyThatPlays' Live Stream Page");
            break;
      }
      &lt;/script&gt;
  </code></pre>
  
  <p>I also tried removing the "" from document.write() and it still dont load and breaks the rest of the cases.</p>