[Javascript] Redirect the browser using JavaScript
JavaScript The Using Browser Redirect
2023-09-14 08:59:20 时间
Three methods to preform redirection in browser:
- widnow.location.href
- window.location.assign
- window.location.replace
1 & 2, they are pretty much the same, just 1 is the property and 2 is the function, some people say use property is a little bit faster than calling a function. So they prefer using 1th.
http://stackoverflow.com/questions/10302905/location-href-property-vs-location-assign-method
1: window.location.href="http://www.egghead.io";
2: window.location.assign("http://www.egghead.io");
The differeces between 1 & 2 with 3 is:
replace(), is that replace() removes the URL of the current document from the document history, meaning that it is not possible to use the "back" button to navigate back to the original document.
相关文章
- JavaScript多个音频audio标签或者多个视频video,点击其中一个播放时,其他的停止播放
- [Javascript Performance] Optimisation and deoptimization
- [Javascript] Module Pattern
- [Javascript] Wait for the Fastest JavaScript Promise to Be Fulfilled with Promise.any()
- [Javascript] Create an Image with JavaScript Using Fetch and URL.createObjectURL
- [Javascript] Conditionally spread entries to a JavaScript object
- [Javascript] Await a JavaScript Promise in an async Function with the await Operator
- [Javascript] Convert a Callback-Based JavaScript Function to a Promise-Based One
- [Javascript] Understanding the .constructor property on JavaScript Objects
- [Javascript] Link to Other Objects through the JavaScript Prototype Chain
- [Javascript] Delegate JavaScript (ES6) generator iteration control
- [Javascript] Decorators in JavaScript
- [Javascript] Gradient Fills on the HTML5 Canvas
- [Javascript] Understanding the difference between .prototype and .__proto__ in JavaScript
- [WASM Rust] Use the js-sys Crate to Invoke Global APIs Available in Any JavaScript Environment
- [Javascript] Delegate JavaScript (ES6) generator iteration control
- [Javascript] Closure Cove, 1
- Atitit. 数据约束 校验 原理理论与 架构设计 理念模式java php c#.net js javascript mysql oracle
- 成功解决MSB8020 The build tools for v141 (Platform Toolset = ‘v141‘) cannot be found. To build using the
- The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0