Javascript iFrame中加载的网站链接滚动到顶部

Javascript iFrame中加载的网站链接滚动到顶部,javascript,html,iframe,cross-browser,Javascript,Html,Iframe,Cross Browser,具有指向在右侧IFrame中加载的不同页面的链接。我希望页面总是在顶部加载——因此在子页面的head标记中添加了以下代码: <head> <script type='text/javascript'> parent.document.body.scrollTop = 0; </script> </head> parent.document.body.scrollTop=0; 它适用于Safari,但不适用于Firefox或C

具有指向在右侧IFrame中加载的不同页面的链接。我希望页面总是在顶部加载——因此在子页面的head标记中添加了以下代码:

<head>
  <script type='text/javascript'> 
    parent.document.body.scrollTop = 0;
  </script>
</head>

parent.document.body.scrollTop=0;
它适用于Safari,但不适用于Firefox或Chrome。。。。什么在所有浏览器中都有效

谢谢