Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Trouble getting flash Embed to display while browsing locally (file:///  etc) in Firefox

Posted on 2007-08-08
37
Medium Priority
?
346 Views
Last Modified: 2013-12-07
Hey all,  

      The following code embeds a flash movie into an html document.  The javascript nested inside this object tag allows me to pass the URL scope variables in as variables to the flash movie (searchString is the URL scope variables) in case you were wondering what thats about.

Now,  this code works fine when browsed to via a server (http://localhost/myDir/thisfile.html)  but doesn't work if browsed to locally (file:///C:/myDir/thisfile.html).  

Due to the unique circumstances of my project; I need this to be able to work when browsed to locally; does anyone have an idea of how I can proceed?    Thank you very much.  
----------------

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="1280" height="768" id="PaxMaster" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="PaxMaster.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />

  <script type="text/javascript">
 
  document.write('<embed src="PaxMaster.swf' + searchString + '" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" name="PaxMaster" align="middle" allowScriptAccess="sameDomain" width="1280" height="768"</embed>');
 
  </script>
 
</object>

-------------------------
0
Comment
Question by:andrewaiello
  • 23
  • 9
  • 4
  • +1
37 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 19654319
You mean it works
http://localhost/myDir/thisfile.html?parms
but doesn't work if browsed to locally
file:///C:/myDir/thisfile.html?parms

that is due to some browser setups (IE especially) does not see the query string from harddisk...
I do not have a suggestion
0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19654424
A few notes:

I must be using Firefox

and the PaxMaster.swf is in the same directory as this file.
0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19654431
Yes, that is correct.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:andrewaiello
ID: 19654456
I am not sure if that is the only problem because if I drop the paramaters from this  http://localhost/myDir/thisfile.html?parms    the swf will still embed (the screen will go black)  it just doesn't do anything else.    

However if I drop the params from file:///C:/myDir/thisfile.html?parms   the screen doesn't even go blank; the embed doesn't happen at all.
0
 
LVL 30

Expert Comment

by:third
ID: 19654619
how do you get your searchstring when browsing locally? maybe you are getting an invalid value.
0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19654655
The search string is acquired by the javascript:

searchString = document.location.search;


If this is a problem, I'm not sure if it can be the only one (by the logic of the screen not turning black in my previous post).   Thanks.
0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19655253
Hmm...this may in fact be the key problem.  I just made a simple html file with a flash embed (no searchstrings or anything)  and it work both ways (local and server),
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 19655313
Try saving this on your harddisk

<script>
alert(location.href+'\n'+((location.search)?location.search.substring(1):'nothing passed'))
</script>
<a href="#" onClick="this.href=location.href.split('?')[0]+'?parm=parm1'">Try</a>
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 19655338
I have this url:
file:///c:/temp/testpassed.html?parm=parm1
0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19655477
Yes I get the same thing.. that seems good.


In my original file I put some code to ALERT the searchString; and it did in fact work when browsed locally...but it changed it, like it added the special characters for & and such; maybe thats what messed it up?


 
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 19655638
Sorry, your comment does not enlighten me :(
0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19655685
Okay Basically here is the situation:

1)  I've determined that an embeded flash movie will display no problem if you browse to the file locally or from a server

2)  I've determined that the searchString actually does come in okay locally or from a server

3)  My file doesn't work... which is a flash movie embeded with the searchString passed in as an argument.....and based on 1) and 2).... I have no idea why!
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 19655747
Can you please escape() you searchString:
alert(searchString);
document.write('<embed src="PaxMaster.swf' + escape(searchString) + '" ...


0
 
LVL 63

Accepted Solution

by:
Zvonko earned 2000 total points
ID: 19655778
Perhapse force the URL to be a queryString by adding a question mark charcter hardcoded:
searchString = searchString.substr(1);
document.write('<embed src="PaxMaster.swf?' + escape(searchString) + '" ...

0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19655867
Okay i changed the embed to:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="1280" height="768" id="PaxMaster" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="PaxMaster.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />

  <script type="text/javascript">
 
  alert(searchString);
  document.write('<embed src="PaxMaster.swf' + escape(searchString) + '" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" name="PaxMaster" align="middle" allowScriptAccess="sameDomain" width="1280" height="768"</embed>');
 
  </script>
 
</object>

-------------

This didn't change the behavior at all, still doesn't work

I tried it with searchString = window.location.search;  and searchString = document.location.search.


The URL it bounces too is (and the one it alerts)  is:

file:///C:/CFusionMX/wwwroot/PaxLive/testSchedule.html?slideNum=3&amp;slide1=PaxSlide1.swf&amp;slide2=PaxSlide2.swf&amp;slide3=PaxSlide3.swf&amp;slide4=&amp;slide5=

(notice it adds the strange characters)


Now, even if just hand-type the right stuff in the url box and hit enter (as in:  file:///C:/CFusionMX/wwwroot/PaxLive/testSchedule.html?slideNum=3&slide1=PaxSlide1.swf&slide2=PaxSlide2.swf&slide3=PaxSlide3.swf&slide4=&slide5= )

It still doesn't work.    Pretty stumped.  Thanks.  
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 19655899
Add that question mark character please:

alert(searchString);
  document.write('<embed src="PaxMaster.swf?' + escape(searchString) + '"


0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19655909
Tried that;  No effect.
0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19656041
Could be something about that complicated embed tag thats messing things up...  I tried swapping out the whole object tag for this:  

object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="1280" height="768" id="PaxMaster" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="PaxSlide3.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />

  <embed src="PaxSlide3.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1280" height="768"></embed>
 
</object>

-----     (PaxSlide3.swf is a dummy movie).    

And that at least embedded.
0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19656109
On a whim I tried changing the document.write embed part to window.write  but that did nothing too.
0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19656142
Ya know... I think the Div above the embed might be somehow nullifying it:   When i removed the DIV it seemed that the embed happened (the screen became scrollable horizontally and vertically (the flash file is large)...but  from our earlier question we noticed that the values read in from the file dont come in unless the  div is there.....

<div id="txt"></div>
 <div id="theExample">Loading...</div>


<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="1280" height="768" id="PaxMaster" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="PaxMaster.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />

  <script type="text/javascript">
 
  alert(searchString);
  document.write('<embed src="PaxMaster.swf' + escape(searchString) + '" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" name="PaxMaster" align="middle" allowScriptAccess="sameDomain" width="1280" height="768"</embed>');
 
  </script>
 
</object>
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 19656150
Get PageSpy and look your page construction in IE briwser.
When you get your script right then switch back to Mozilla.
Here is the PageSpy: http:/M_1344026.html

0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19656180
Okay, btw i noticed something that seems Key to figuring this out:  

When the page first loads as in:  file:///C:/CFusionMX/wwwroot/PaxLive/testSchedule.html      the embed is actually there (for a split second)   but when it redirects to the same page with anything at all in the url scope  (for example file:///C:/CFusionMX/wwwroot/PaxLive/testSchedule.html?hey)  the embed does not show up.
0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19656192
Thats why when i took the div out I saw the embed (because the redirection couldn't happen without the div)
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 19656210
That div was only for testint. Remove that one statement that assigns innerHTML to that div and you can go on without script erors. That div is NOT necessery for execution, only for visaul test.

0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19656253
K, i removed the line:  document.getElementById('theExample').innerHTML=responseText;    in the function  PostFileReady

and those two Div lines.    I am now looking at that pagespy thing.  

Did my recent observation spark any ideas, btw?
0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19656382
Okay, I was using the PageSpy, and I'm not really sure what I am supposed to be doing with it.  I've been looking through all the page information and nothing seems to be jumping out as an error:

https://ssl117.alentus.com/jkingsweb/gbt/PaxTest/testSchedule.html?tsdg

(i just put that  ?tsdg at the end to prevent the redirect)
0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19656410
When I click on the "this" tap of PageSpy it shows some flickering, and then freezes up.  
0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19656453
Further narrowing it down....

If I change this:  

 " document.write('<embed src="PaxMaster.swf' + escape(searchString) + '" pluginspage...."

to this:

  " document.write('<embed src="PaxMaster.swf' + "" + '" pluginspage...."

(just knocking out the searchString part); the embed happens (after the redirect as well as before)... but of course the embeded flash file can't do anything useful because it needs those values from the searchString.    

At least its really narrowed down now...
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 19657186
OK, two observations:
1.) The allert() does NOT happen, that mean script is not executed at all. Because <script> cannot be inside <object> </object> section.
2.) You have several pages, but changed only some to my textFile method.

For the first you have to put all HTML for the <object> to String and add to that string the searcgString parts and write then the complette <object> at once to the page.

0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19657392
Hmm,

1)  my alerts happen... which alert are you talking about?

2)  i should only have this one page: testSchedule.html  that reads in the text file testValues.txt and embeds the PaxMaster.swf file.... what other page are you referring to?



I have some more observations on my end....

It seems that there is indeed a problem with the way that escape(searchString) is interpreted because if I just hardcode the information,   as in just putting:

document.write('<embed src="PaxMaster.swf' + "?slideNum=3&slide1=smoothie1.swf&slide2=smoothie2.swf&slide3=leonidas.jpg&slide4=&slide5="+ '" plug

It works.     Now; this information:  
?slideNum=3&slide1=smoothie1.swf&slide2=smoothie2.swf&slide3=leonidas.jpg&slide4=&slide5=
should be what is coming in via the searchString...but apparently its getting messed around with in some way??   Thanks again; sorry this is so complicated!!!
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 19657432
When I click on uper URL then I see no alert()
Do you see alert when you open this:
https://ssl117.alentus.com/jkingsweb/gbt/PaxTest/testSchedule.html?tsdg

Show me one URL that we bot can observe and where you do the changes.

0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19658143
I got it working!   Thanks for your assistance again!   Now... I suspect there might be one more issue relating to this, so I'll leave the topic open for now.   Thanks again!!!
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 19660374
You are welcome.
0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19672144
Damn; that problem I was worried about occurred.  It seems that when the .swf file is transferred via FTP something is slightly changed and it doesn't work.  To clarify, if I download the swf from a browser and run it (through that testSchedule.html stuff)  it works.  But if the same exact file is instead transferred via FTP; it doesn't work.  Have you ever heard of something like this?
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 19672738
Yeap!
FTP works in either of two transfer modes: ASCII or BINARI (binary or IMAGE) mode.
Default FTP transfer mode is ASCII for text transfer to convert line break correctly betwean DOS and Unix or Mainframe systems. But that text conversion destroys your binary image of the flash.
So before transfer you have to switch the transfer mode to BINARY.
On Windows FTP is the line command for that switch to BINARY transfer mode: binary


0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19673012
Good advice;  Unfortunately I already tried both Binary and Ascii modes..
0
 
LVL 1

Author Comment

by:andrewaiello
ID: 19673627
I'll close out this topic; but the other issue is here:  http://www.experts-exchange.com/Networking/Protocols/Application_Protocols/FTP/Q_22755336.html

Driving me nuts...just got off a 2 hour conference call with this a-hole IT lord talking down to me...but he couldn't figure it out either.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When I'm searching for answers on Experts Exchange, I often use Google because it's built into my browser.  To search only on Experts Exchange, I use the "site:" search operator, which can be cumbersome to type out each time I want to run a search.…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question