deanagit / swfobject

Automatically exported from code.google.com/p/swfobject
0 stars 0 forks source link

swfobject.embedSWF target of onclick works in IE but not FF or Chrome #420

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Clicking on an image link that calls swfobject.embedSWF in an HTML page.

What is the expected output? 
I expect to see the embedded video play - as it does when I use IE 7.0

What do you see instead?
When I use FF 3.5.6 and click on the image, the page reloads.
There are no errors reported in the FF console or when using Firebug.

What version of the product are you using? 2.2

On what operating system?
XP Pro and Vista - both behave the same.

I've tried v10 and v9 of Flashplayer - and the results are the same.

Please provide any additional information below.

I've noticed that IE doesn't seem to re-render the whole page when I click
on the link to run the embedded video - but that FF does.  I'm not sure if
this is causing the end result.  I read through this forum and found that
inserting swfobject.switchOffAutoHideShow(); was supposed to help mitigate
rendering race conditions - but that fix does not help in this example. 

Here is the html:

<div id="videoDiv">
  <a href="" onclick="playvid();">
  <img src="images/Triton2.jpg" width="480" height="295" border="0"
alt="Triton Technologies video title screen" />
  </a>
</div>

Here is the playvid function:

    function playvid()
    {

    // Lets Flash from another domain call JavaScript
    var params = { allowScriptAccess: "always" };

    var flashvars = {};

    var attributes = {};

    swfobject.switchOffAutoHideShow();

swfobject.embedSWF("http://www.youtube.com/v/k1Noip2HMRs&enablejsapi=1&playerapi
id=player1&showinfo=0&autoplay=1",
                       "videoDiv", "480", "295", "8.0.0", false, flashvars,
params, attributes);
    }

Original issue reported on code.google.com by Howie.Ch...@gmail.com on 29 Dec 2009 at 11:48

GoogleCodeExporter commented 9 years ago
This is not an issue to do with SWFObject , but how you have set up your link. 
Please 
submit authoring questions to the list before posting a "bug"

Have read from a google search on how to invoke JS functions without the 
browser 
thinking it should be navigating somewhere.

Basically you want something like:
<a href="#" onclick="aFunction();return false;">

Original comment by aran.rhee@gmail.com on 6 Jan 2010 at 10:58

GoogleCodeExporter commented 9 years ago
Thanks.  Found this this morning before I read your comments - so to add a bit 
more
detail/explanation - from:http://codingforums.com/showthread.php?t=56428

As I tested it in Firefox, I found out that <button>'s default behavior is a 
submit
button (unlike in IE). So you have to do a return false to cancel form 
submission...

<button onclick="testbutton(); return false;">Find!</button>

or:

<button onclick="return testbutton();">Find!</button>

and then put return false at the end of the function. 

Original comment by Howie.Ch...@gmail.com on 6 Jan 2010 at 3:25