网络安全 频道

Java applet 安全性探究

  父页和子页的关系

  引用“浅析浏览器的跨域安全问题”一文的代码:

<script>
x
=window.open("about:blank");
x.location
="http://www.163.com" //访问163网站
setTimeout(
function(){
x.location
="http://127.0.0.1";
},
5000) //5秒后重定向到127.0.0.1
</script>

再次使用applet实现以上效果:

public class writeFile extends Applet implements Runnable{
        
private Thread thread = null;
        
private String url;
        
public void run()
        {
                try {
                        this.getAppletContext().showDocument(
new URL(url),"kxlzx");
                } catch (MalformedURLException e) {
                }
        }
        
public void start()
        {
                try {
                url
= "http://www.sohu.com";
                thread
= new Thread(this);
                thread.run();
                thread.sleep(
5000);
                url
= "http://www.sina.com";
                thread
= new Thread(this);
                thread.run();
                } catch (Exception e) {
                }
        }
}

IE和FF都执行成功,子窗口先访问了sohu,过5秒,访问了sina,子页将永远受制于父页

0
相关文章