有没有一种使用prototype重新加载页面(或重定向到自身)的方法?
你不需要使用JavaScript库来实现此功能。一个简单的:
window.location.reload();
或者window.location.href = window.location.href;
应该足以满足需求。
我怀疑这个想法。似乎为像location.reload(true);
这样简单的东西编写一个辅助函数没有多大意义,因为它并不经常使用。
Location.prototype.reload
的正式文档。WhatWG和W3C也都没有提到它。它似乎是在这个版本中引入的。不过,它确实可以工作。 - Sebastian Simontrue
参数,这也很奇怪。 - Sebastian Simonwindow.location.href = window.location.href;