HTML and CSS Reference
In-Depth Information
doing this, we can use the page-break-after setting, as shown in the following
code snippet:
h2,
h3 {
page-break-after: avoid;
}
}
What are protocol-relative URLs?
In HTML5 Boilerplate, when we refer to jQuery, we refer to it as follows:
<script src="//ajax.googleapis.com/ajax/libs/
jquery/1.8.1/jquery.min.js">
</script>
Note that we do not have either http or https in front of the URL; instead, it starts
with // . These are called protocol-relative URLs and are useful when you want to
use a protocol-agnostic resource in a HTTP or HTTPS environment.
When you serve pages using HTTPS, browsers will throw warnings and errors when
the page loads assets and resources that use HTTP protocol. To prevent this, you
need to ensure you use the HTTPS protocol for all the assets you are requesting.
This is typically not a problem if you are using relative URLs to refer to assets within
the parent folder of your page. However, if you are referring to external URLs like the
CDN URL for jQuery (shown previously), then you need to ensure you use https
when the page is being served with the HTTPS protocol and the http prefix when
the page is being served with HTTP protocol.
Instead of using JavaScript to do that determination, simply omitting the protocol
ensures browsers use the currently used protocol when requesting that external
URL. In this case, if this page gets served on HTTPS as https://example.com ,
then the URL requested will be https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/
jquery.min.js .
Search WWH ::




Custom Search