jQuery location href
Possible Duplicate:
How do I redirect to another webpage?
I remember there's a redirect function in jQuery.
It was like:
$(location).href('http://address.com')
But what was it exactly? I couldn't remember and can't find it using Google Search.
没有必要使用jQuery。
window.location.href = 'http://example.com';
Use:
window.location.replace(...)
See this Stack Overflow question for more information:
How do I redirect to another webpage?
Or perhaps it was this you remember:
var url = "http://stackoverflow.com";
$(location).attr('href',url);
This is easier:
location.href = 'http://address.com';
Or
location.replace('http://address.com'); // <-- No history saved.
链接地址: http://www.djcxy.com/p/1938.html
上一篇: 我想在特定时间后加载另一个HTML页面
下一篇: jQuery位置href