为何不能刷新?

emu_ston 2003-02-27 03:34:29
<frameset>
<frame src="javascript:alert(location);"></frame>
</frameset>

把这个页面刷新一下,然后告诉我为什么会这样。

英文版win2000+IE5
...全文
43 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
Go_Rush 2003-02-27
  • 打赏
  • 举报
回复
以前写程序都要向下兼容,比如我们常常会问自己

这个页面在ie6.0下正常,那么在ie5.0下会不会正常呢?
我是不是用到了ie6.0才有的新功能,新特性。

现在变了,ie5.0下正常,反过来我还要问: ie6.0下会不会正常呢?

比如:
<script>
window.open("test.htm","","fullscreen")
</script>

test.htm:

<script>
window.resizeTo(400,300)
</script>

在ie5.0下是如此的完美,在ie6.0下确是不堪入目。

所以只好
if (ie5.0) window.open(..)
if (ie5.5+) window.createPopup(..)

这叫向上兼容
emu 2003-02-27
  • 打赏
  • 举报
回复
呵呵,我都用IE5的
imafool 2003-02-27
  • 打赏
  • 举报
回复
sp1怎么这么恼火。
emu 2003-02-27
  • 打赏
  • 举报
回复
<frameset>
<frame src="about:<script>location=0;</script>"></frame>
</frameset>
Go_Rush 2003-02-27
  • 打赏
  • 举报
回复

比如 frame.htm

<frameset>
<frame src="javascript:eval(location.replace('http://www.371.net/'))"></frame>
</frameset>

frame.htm装载的时候就执行了 javascript代码

所以 帧窗口装载的是 http://www.371.net

而不是我们想象的
javascript:eval(location.replace('http://www.371.net/'))

Go_Rush 2003-02-27
  • 打赏
  • 举报
回复
你下面的那几个奇怪在我这里一点都不奇怪了。呵呵

因为我的ie是 ie6;sp1

这个版本对于 about协议,只支持about:blank

其他about:比如 about:123 ,about:test

一概不认,如果你要试图这样做
<iframe src="about:test"></iframe>

或者直接在地址拦输入 about:gorush


得到的结果将是:


取消操作
Internet Explorer 不能链接到您请求的网页。此页可能暂时不可用。
emu 2003-02-27
  • 打赏
  • 举报
回复
还有更更奇怪的:

<frameset>
<frame src="about:<script>location=NaN;</script>"></frame>
</frameset>
emu_ston 2003-02-27
  • 打赏
  • 举报
回复
还有更奇怪的事:
<frameset>
<frame src="about:<script>location=void(0);</script>"></frame>
</frameset>

谁叫它刷新了来着?
emu_ston 2003-02-27
  • 打赏
  • 举报
回复
Go_Rush(阿舜) :
alert()和void()一样是没有返回的,所以上面等效于:
<frameset>
<frame src="javascript:void(0);"></frame>
</frameset>
我只是把location打出来看看到底发生了什么好事。


<frameset>
<frame src="about:<script>void(0);</script>"></frame>
</frameset>
这样就没有问题了
emu_ston 2003-02-27
  • 打赏
  • 举报
回复
呵呵,你被降级啦?
zxhong 2003-02-27
  • 打赏
  • 举报
回复
用马甲提问题?
Go_Rush 2003-02-27
  • 打赏
  • 举报
回复

我把你的代码保存为 frameset.htm,然后打开

首先 ie装载 frameset.htm
遇到<frame src="javascript...">就执行这个函数。弹出一个消息框。
就好象<img src="javascript:alert()">一样


同时帧 frame作为一个新的窗口装载 "javascript:alert(location)"

ie 认为 javascript:alert(location) 是一个url,于是去寻找 javascript:alert(location)
这个文件,因为无法解析主机地址,就报告 找不到服务器或发生 DNS 错误


个人理解,不对请指正

87,915

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧