window.location.hash = "#globalSearchView";
当前我正在使用哈希更改函数
$(window).on("hashchange",function(e) { var hash = window.location.hash; switchtabs(hash); });
它只在哈希被更改时工作,但在相同哈希时不工作。我想调用函数 每当这条线
window.location.hash = "#whatever";
无论是同一哈希还是不同哈希都执行。谢谢
也许是这个?
var l = location.prototype; Object.defineProperty(l, 'hash', { get: function() { return this.hash; }, set: function(t) { this.hash = t; switchtabs(t); } });