4 ms·
Well, that seems like a bad idea. Out of curiosity, does anyone know what happens if I have: `<a href="google.zip">Link</a>`? Will the browser navigate to an e
by MrZander 3y ago
Well, that seems like a bad idea.
Out of curiosity, does anyone know what happens if I have: `<a href="google.zip">Link</a>`?
Will the browser navigate to an external site or will it try to download google.zip?
- herpderperator 3y agoYou need a http:// http:// or https:// https:// prefix to tell the browser to navitage to another site, otherwise the request defaults to being a relative path.
- MrZander 3y agoI see, I assume that is true for all TLDs? (Can you tell I don't do much web front-end lol)
- iforgotpassword 3y agoOr just //
- AgentME 3y agoThis behavior doesn't depend on TLDs. A href will be to the local origin unless it starts with a protocol ("https://example.com https://example.com") or two slashes (protocol-relative link, like "//example.com"). (The rest of the rules are that if an href starts with a single slash, then it will be a domain-relative link, otherwise it will be relative to the current URL's path.)
- nevi-me 3y agoIt should try to download `google.zip` relative to your current URL. For it to be a domain name it should at minimal be href="//google.zip", where the browser will inherit your current protocol.
- deleted 3y ago[deleted]
- jasonjayr 3y agoIt will get resolved relative to the current location. You would need (at a minimum) '//google.zip' to trigger a cross-domain link