admin管理员组文章数量:1318563
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.
Thanks,
Tee
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./javascript/earthquake-effect-shake-the-browser
Thanks,
Tee
- 11 AFAIK, that is no longer possible in modern browsers. And thank goodness for that :) – Pekka Commented Feb 24, 2011 at 0:43
- @Pekka: Though it could be more interesting again for modern browser games... "special effects" :D – Felix Kling Commented Feb 24, 2011 at 0:53
- Unfortunately--once allowed via NoScript--the script example posted does work. – JYelton Commented Feb 24, 2011 at 1:40
- I think by default the option in Firefox to "move or resize existing windows" is NOT enabled? So the script might work, but Firefox might be stopping it. – Jeff Commented Feb 24, 2011 at 1:43
1 Answer
Reset to default 8Because 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>
本文标签: Javascript browser shake on FirefoxStack Overflow
版权声明:本文标题:Javascript browser shake on Firefox - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742049580a2417994.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论