Languages
[Edit]
EN

JavaScript - detect URL request redirection

9 points
Created by:
Sujay
512

In this short article, we would like to show how to detect URL request redirection using JavaScript.

Quick solution:

 

Reusable logic

Edit

XHR based solution

Edit

This solution works in older web browsers.

 

fetch() based solution

Edit

Warning: Fetch API was introduced in major web browser around 2015-2017 (ES6), in Node.js in 2022, and in Deno in 2020. 

 

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join