[wp-hackers] Protocol Relative URLs and wp_register_script()
morgan.estes at gmail.com
Mon Mar 3 22:01:31 UTC 2014
I use protocol-relative links 99% of the time; it's that 1% that will bite
The only time I don't is when I *know* that the subdomain changes on SSL
(like when some site use ssl.example.com or secure.example.com). One
real-world example was a script loading from a CNAME domain on CloudFront,
but the site admin didn't configure the domain to use SSL certificates.
I suggest checking to make sure the URL works with both http and https,
then going with the protocol-relative links.
Morgan W. Estes
On Mon, Mar 3, 2014 at 12:02 PM, Mike Walsh <mpwalsh8 at gmail.com> wrote:
> Thanks, I have rolled this patch into my plugin and will do the same for
> others as I make updates.
> On Mon, Mar 3, 2014 at 11:55 AM, Otto <otto at ottodestruct.com> wrote:
> > On Mon, Mar 3, 2014 at 7:54 AM, Mike Walsh <mpwalsh8 at gmail.com> wrote:
> > > Over the weekend I received a patch for one of my plugins which changes
> > how
> > > I load a jQuery script from the Microsoft CDN. The change removes the
> > > "http:" from the URL leaving the remainder, including of the URL
> > including
> > > the "//". The purpose of this change is to avoid mixcontent warnings
> > when
> > > serving the site over https.
> > >
> > > I was a bit leery of making the change as submitted but did some
> > > and found this article:
> > >
> > > http://www.paulirish.com/2010/the-protocol-relative-url/
> > >
> > > Is there a better way to support this within WordPress or is this
> > solution
> > > generally accepted as the right way to do it?
> > Using protocol-relative URLs is a good idea. I've been changing lots
> > of things to do it that way.
> > -Otto
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> Mike Walsh - mpwalsh8 at gmail.com
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers