Is it valid to replace http:// with // in a <script src="http://...">?
Posted
by Darryl Hein
on Stack Overflow
See other posts from Stack Overflow
or by Darryl Hein
Published on 2009-02-15T00:15:18Z
Indexed on
2010/03/16
23:41 UTC
Read the original article
Hit count: 279
I have the following tag:
<script type="text/javascript" src="https://cdn.example.com/js_file.js"></script>
In this case the site is HTTPS, but the site may also be just HTTP. (The JS file is on another domain.) I'm wondering if it's valid to do the following for convenience sake:
<script type="text/javascript" src="//cdn.example.com/js_file.js"></script>
I'm wondering if it's valid to remove the http: or https: ?
It seems to work everywhere I have tested, but are there any cases where it doesn't work?
© Stack Overflow or respective owner