3 ms·
They do work in every browser browser I've tested. It's worth noting that I did find a couple browsers that won't accept a protocol-less URL in the address fie
by Encosia 16y ago
They do work in every browser browser I've tested. It's worth noting that I did find a couple browsers that won't accept a protocol-less URL in the address field (iOS Safari being one), but those browsers did properly handle protocol-less script references in documents. So, it's easy to mistake those as browsers lacking support, but they actually do handle the protocol-less URLs correctly where it matters.
I ran this simple HTML page through Browser Shots to test about as wide a variety of browsers as possible, quick and easy:
<html>
<head>
<title>Testing protocol-less URL</title>
</head>
<body>
<p>A message should hopefully appear below me...</p>
</body>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
if (typeof jQuery !== 'undefined') {
jQuery('body').append('<p>Protocol-less reference worked!</p>');
}
</script>
</html>
- Sephr 16y ago> I did find a couple browsers that won't accept a protocol-less URL in the address field Why would you expect them to accept that? The URIs aren't protocol-less, they have relative protocols, and there's nothing to relate the URI to.
- Encosia 16y agoI didn't know what to expect, which is why I was testing. All of the desktop browsers on my machine do resolve the protocol-less URL in the address field though (as HTTP). I mentioned it because I can see how it would be easy to notice that behavior on the desktop, see the same thing fail on an iPhone, and then assume that mobile Safari doesn't support these URLs at all.