I'm having trouble showing urls with redirect with an automation tool i'm using so I'm thinking of checking the url for redirects first before opening the popup.
Is it possible to get the redirect URL using javascript (no jquery or other js framework as this is not supported by the tool)?
Thanks!
href = "https://www.example.com"; Simply insert your target URL that you want to redirect to in the above code.
To redirect one HTML page to another page, you need to add a <meta> tag inside the <head> section of the old HTML page. The <head> section of an HTML document contains metadata that is useful for the browser, but invisible to users viewing the page.
In theory, yes. In practice, probably not.
In theory you could do an XHR head request to the URL, then check the location header to see if what you asked for is what you ended up getting. XHR will automatically follow 301/302 redirects, so there's no use checking the status code - Is it possible for XHR HEAD requests to not follow redirects (301 302)
In practice, unless the domain you're asking is your domain, or has a Access-Control-Allow-Origin
header (I think it's header), the request will fail due to cross site request restrictions. HEAD XMLHttpRequest on Chromium
If you've got access to the server running your tool, you should be able to whip up a "proxy" page that issues the HEAD request, then you can XHR call your server page and it would return where the HEAD request said you'd end up.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With