Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript browser shake on Firefox

Tags:

javascript

Is it possible to use Javascript to shake Firefox browser?
I find a script that works on Safari but that script doesn't seem to work on Firefox. http://www.jhuskisson.com/javascript/earthquake-effect-shake-the-browser

Thanks,
Tee

like image 742
teepusink Avatar asked Mar 02 '26 11:03

teepusink


1 Answers

Because I use NoScript, this code would not execute unless I allowed it on my browser. But be warned, if you shake my browser window, I will probably blacklist your site and send flying monkeys to devour your soul.

Here is an implementation that works...use with caution:

<html>
    <head>
        <script language="javaScript">
            function shakescreen(n)
            {
                if (parent.moveBy)
                {
                    for (i = 10; i > 0; i--)
                    {
                        for (j = n; j > 0; j--)
                        {
                            parent.moveBy(0, i);
                            parent.moveBy(i, 0);
                            parent.moveBy(0, -i);
                            parent.moveBy(-i, 0);
                        }
                    }
                }
            }
        </script>
    </head>
    <body>
        <form>
            <input type="button" onClick="shakescreen(4)" value="Shake Browser Window">
        </form>
    </body>
</html>
like image 96
JYelton Avatar answered Mar 04 '26 23:03

JYelton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!