Problem with OnLoad event

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dariusz

    Problem with OnLoad event

    I have a page which is a mixture of PHP and Javascript, it's not a PHP
    problem as it is only printing the Javascript I want out to the browser.
    When the page executes, in Internet Explorer the onload popup event is
    executed successfully, but in Mozilla Firefox it does nothing at all.

    Anyone know what is going on? Below is the script code (carriage return
    deliberate to stop word wrap).

    Thanks

    Dariusz



    <HTML>
    <BODY onload="PicLoad ()">

    <?PHP
    // Section to generate the Javascript pop-up for correct
    // dimentions of the proposed pop-up.

    echo '<script type="text/javascript">'." \n";
    echo '<!--'."\n\n";

    echo 'function PicLoad()';
    echo '{';
    echo 'window.open("./01.jpg","Pictur e","width=370,h eight=260,
    toolbar=no,menu bar=no,resizeab le=no")';
    echo '}';

    echo '//-->'."\n";
    echo '</script>';

    echo "<BR>Successful ly executed PHP script!!!";
    ?>

    </BODY>
    </HTML>
  • David Dorward

    #2
    Re: Problem with OnLoad event

    Dariusz wrote:
    [color=blue]
    > I have a page which is a mixture of PHP and Javascript, it's not a PHP
    > problem as it is only printing the Javascript I want out to the browser.
    > When the page executes, in Internet Explorer the onload popup event is
    > executed successfully, but in Mozilla Firefox it does nothing at all.[/color]

    Mozilla has anti-spam features which block window.open when triggered from
    onload events (among other things). You might have these enabled.

    --
    David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>

    Comment

    • Dariusz

      #3
      Re: Problem with OnLoad event

      In article <c5s2no$pnd$1$8 300dec7@news.de mon.co.uk>:[color=blue]
      >Mozilla has anti-spam features which block window.open when triggered from
      >onload events (among other things). You might have these enabled.[/color]

      Just checked, and Javascript pop-ups are enabled on my setup.

      Can't see why it's not working when it should be.

      Dariusz

      Comment

      • Joakim Braun

        #4
        Re: Problem with OnLoad event

        "Dariusz" <ng@lycaus.plus YOURSHIT.com> skrev i meddelandet
        news:E2ggc.3372 1$Y%6.4343369@w ards.force9.net ...[color=blue]
        > I have a page which is a mixture of PHP and Javascript, it's not a PHP
        > problem as it is only printing the Javascript I want out to the browser.
        > When the page executes, in Internet Explorer the onload popup event is
        > executed successfully, but in Mozilla Firefox it does nothing at all.
        >
        > Anyone know what is going on? Below is the script code (carriage return
        > deliberate to stop word wrap).
        >
        > Thanks
        >
        > Dariusz
        >
        >
        >
        > <HTML>
        > <BODY onload="PicLoad ()">
        >
        > <?PHP
        > // Section to generate the Javascript pop-up for correct
        > // dimentions of the proposed pop-up.
        >
        > echo '<script type="text/javascript">'." \n";
        > echo '<!--'."\n\n";
        >
        > echo 'function PicLoad()';
        > echo '{';
        > echo 'window.open("./01.jpg","Pictur e","width=370,h eight=260,
        > toolbar=no,menu bar=no,resizeab le=no")';[/color]
        <snip>

        Try single quote characters (apostrophes) around the feature string:
        echo 'window.open("./01.jpg","Pictur e",\'width=370, height=260,
        toolbar=no,menu bar=no,resizeab le=no\')';

        Joakim Braun


        Comment

        • Dariusz

          #5
          Re: Problem with OnLoad event

          In article <cvqgc.38755$zm 5.17225@nntpser ver.swip.net>, wrote:[color=blue]
          >Try single quote characters (apostrophes) around the feature string:
          >echo 'window.open("./01.jpg","Pictur e",\'width=370, height=260,
          >toolbar=no,men ubar=no,resizea ble=no\')';[/color]

          Didn't help.

          However, I found out that despite Firefox browser having the setting to
          allow popups enabled (I even tested it on external sites and it worked)...
          it somehow assumed I did not want popups on "localhost" , which is why I did
          not see any. What the config said and what it actually was doing was
          totally different.

          After editing the config files for the browser it allowed me to see the
          popup from "localhost" .

          Thanks to everyone for their help.

          Dariusz

          Comment

          Working...