12

When I type in a url and hit enter, for example abc.com, I don't expect to end up somewhere else. I expect an error page if there isn't a site with that url. But instead I get redirected to another url (another domain even: abc.go.com).

I'm no expert on web technology, but as far I can tell there are two main categories of redirect, DNS/registrar redirects (invisible) and server side redirects (visible, http code 301 or 302).

How do I prevent these server side redirects in chrome? Best case scenario I get a prompt page telling me the page has a different url or IP, asking if I want to continue.

Another example is hackoverflow.com I get redirected to two sites from here, after the first redirect I can glimpse a designed homepage before being moved on to a parking site. I'd like to stop halfway this double redirect and examine the second site.

1

I realize this is far from a perfect answer, as this will only work for responses that serve up content, but I decided to post it as there are currently zero useful, actionable answers.

As a quick-and-dirty solution you may be able to use the debugger (accessible by F12 or CTRL+SHIFT+I in most browsers) to give your self an opportunity to opt out of a redirect.

Run this line in the console before the page runs any scripts of its own:

window.onbeforeunload = function(){ return 'Leave page?'; };

For example, using Chrome:

  • Open the debugger (F12) and switch to the Sources tab.
  • Press F8 to put the debugger into step-through mode.
  • Navigate to the problematic page. It will begin to load but the debugger won't allow scripts to run.
  • Paste the above code into the console and hit enter.
  • Press F8 again to allow scripts to run and let the page finish loading.
  • Now you will see a prompt before any redirect occurs and you'll have an opportunity to cancel it.
  • If the page repeatedly tries to redirect you, you can tell chrome not to display the dialog again. Further attempts by the page to navigate you elsewhere will fail silently.

Prompt restores user control

| improve this answer | |
0

As far as I know, there is no way to disable this function.

More importantly, doing so would break a very basic functionality that Web Servers rely on. You can expect a lot of websites to just stop working.

At bare minimum, - all 'www' redirects would stop working - all 'http-to-https' redirects would stop working

So you would manually have to type in 'https://www' before every domains.

Beyond that, many subpages within websites would stop functioning as well.

So I would not be surprised if Chrome and Firefox developers make it very difficult or impossible to disable Redirects altogether at the browser level.

| improve this answer | |
  • So this security risk is actually a web feature? – jiggunjer May 7 at 5:57
  • Absolutely. It is built into HTTP protocol. A redirect is a server response 301 or 302. – madacoda May 7 at 7:04
  • This is somewhat like saying adblockers don't make sense and would break the web. Wanting to prevent redirects when they have harmful or counter-productive effects shouldn't be a non-starter. OP described a scenario where a page loads before the browser is redirected. This is a scenario I've run into many times. Regardless of the response code, if there is a page served, I would like to have the option of viewing that page. – snarf May 31 at 17:41
-3
  • Open Google Chrome.
  • Update Google Chrome.
  • Click ⋮.
  • Click Settings.
  • Scroll down and click Advanced ▼.
  • Scroll right down to the "Privacy and security" segment.
  • Click the grey "Protect you and your device from risky sites" switch.
  • Use an extension.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.