Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For example there are a lot of sites like bit.ly. I want Chrome to stop and ask me every time such a site tries to redirect me somewhere.

share|improve this question
    
bit.ly uses a 301 redirect, so I'm not sure how Chrome would be able to detect when a redirect is occurring, as it's server-side. –  yutsi Jul 13 '13 at 19:17
    
@yutsi The client must still follow the redirect, or there will be nothing to display. There would bee no point in it, since there literally is no bit.ly page to land on. However one could modify the browser to not do that. This could only be done by actually editing the chrome source. –  zeel Jul 14 '13 at 16:55
    
@yutsi 301 is not server-side. In fact, how it works is that server A replies with 301 and a new URL (which can be, and in cases like bt.ly always is) on a completely different server B, out of A's jurisdiction. Then the browser goes and makes completely different request (which can, by the way, be another 301, etc.). –  Alois Mahdal Jul 15 '13 at 11:17
    
@zeel "since there literally is no bit.ly page to land on" Correct, but not all UAs actually support 301 directly. For example, IIRC curl does not do the second request by default. For this reason, the reply (or at least most I have seen) always contains a human-readable body as well (saying, "the page is not here, but is over there") –  Alois Mahdal Jul 15 '13 at 11:23

1 Answer 1

There are essentially two kinds of redirects, those caused by redirect headers, and those caused by JavaScript.

Redirect headers, like 301, are intended to tell the browser that whatever resource they are looking for is not at the location they are looking, but that the true location is known. This allows the browser to find those resources, instead of a 404 which just tells them the resource is not there.

This kind of redirect is one of the fundamental parts of a web browser, thus there is no easy way to modify the behavior. Chrome is open source, so you can technically do what you are asking, but it would in no way be a simple solution.

The other kind are done by JavaScript. A page loads, and the script on the page tells the browser to load a new page. A simple browser extension could run a script on the page that intercepts all such attempts, and asks the user for permission before allowing them to continue.

share|improve this answer
    
While I can't find the solution, I'd like to point out that if there's no solution without forking, it's actually shame on devs, since being able to decide whether I want to open connection to server B is definitely a valid request from security POV. (Imagine cases where privacy/safety is critical: what if server A was compromised?) –  Alois Mahdal Jul 15 '13 at 11:34
    
An extension could probably keep track of whether the host any given link sent you to is the same as the host that served the page. Then alert you if it isn't consistent. However it would be pretty easy to fool. Again, the redirect functionality is a core part of the web client, and Chrome is intended for consumer use. Also, on the security side, if the site uses HTTPS Chrome will block it if the certificate doesn't match, if you encounter a problem like you described the certificate will be wrong - and Chrome will give you a big red warning page. –  zeel Jul 15 '13 at 15:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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