firefox bug when using iframe and javascript alert() function
<iframe src="http://localhost/perl/cgi.pl" height=1 width=1></iframe>
<script type="text/javascript" charset="utf-8">
alert('test');
window.location = "http://localhost/javascript/index.html";
</script>
以上代码在ie7和safari里调用的都会去请求iframe的src指向的URL,但在Firefox里这个动作却并不会执行,在server端不会收到这个GET请求。
必须在iframe之外加一些html标签,如img/body等才能使此iframe的src指向的请求被执行。如下所示:
<html>
<body>
<iframe src="http://localhost/perl/cgi.pl" height=1 width=1></iframe>
<script type="text/javascript" charset="utf-8">
alert('test');
window.location = "http://localhost/javascript/index.html";
</script>
</body>
</html>
No comments :
Post a Comment