kk Blog —— 通用基础


date [-d @int|str] [+%s|"+%F %T"]
netstat -ltunp
sar -n DEV 1

Firefox报NS_BINDING_ABORTED错误

https://www.weisay.com/blog/firefox-ns-binding-aborted.html

https://blog.51cto.com/phpme/2692985

之前网站一直有一个问题,就是从首页或者列表页点击进入一篇文章页,使用FireFox自带的开发者工具查看的时候,会发现有一个NS_BINDING_ABORTED错误。

因为有个js效果,点击链接会出现“页面载入中……”字样。由于使用了location.href跳转但没有屏蔽链接本身的跳转,发生了两次请求,第一次请求就被火狐浏览器终止了,报了NS_BINDING_ABORTED错误。

1
2
3
4
5
6
7
8
9
10
11
12
<script type="text/javascript">
function sss() {
      location.href = "f.php";
        document.search_export.action="f.php";
      document.search_export.submit();
}
</script>

<form name="search_export" target="" method="get">
<label>arg</label><input style='width:70px' name='arg' id='arg' value='111'>
<input type='button' class='submit' type='submit' value='提交' onclick='sss()'>
</form>

这个问题改起来也比较简单,最简单的就是去掉这个js效果,点击链接进入链接即可。

当然如果想保留这个效果,加个preventDefault事件就行,preventDefault() 方法阻止元素发生默认的行为,就可以屏蔽链接本身的跳转。