WordPress.org

Forums

Use Google Libraries
[resolved] Option to disable Protocol Relative URLs (5 posts)

  1. GermanKiwi
    Member
    Posted 11 months ago #

    Hi Jason, I have a request for you:

    Currently your plugin uses "Protocol Relative URLs", ie. it omits the http or https from the beginning of the URL - for example:

    //ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js

    However this is actually causing problems for a couple of my site viewers (probably due to an old browser or something, but that's beside the point).

    So I'd like to ask if you could add a setting to your plugin, that allows me to choose if it should use Protocol Relative URLs or not. That way everyone can have the plugin work the way that best suits their site's needs.

    Thanks!

    https://wordpress.org/plugins/use-google-libraries/

  2. Jason Penney
    Member
    Plugin Author

    Posted 9 months ago #

    I'll consider it, but WordPress core also now uses protocol relative URLs, so I'm not sure if my changing it for this plugin will help.

  3. GermanKiwi
    Member
    Posted 9 months ago #

    Um - I'm not so sure that is entirely correct. To my knowledge, WordPress core now *supports* protocol relative URLs with the wp_enqueue_script and wp_enqueue_style functions. But it doesn't force them. Whether they are used or not depends entirely on whether a protocol is provided with the URL that is given in the wp_enqueue_script or wp_enqueue_style function. These functions will simply take whatever URL is given to them (either starting with a protocol or without), and output that URL as-is.

    This can be seen in the WordPress patch that provided this functionality via https://core.trac.wordpress.org/ticket/16560. The patch allows for URLs that start with either http, https, or just //.

    Themes also can use either method. I'm using a child theme that runs on Genesis Framework, and my theme has a setting (checkbox) that lets me enable or disable protocol-relative URLs for the theme's own .css and .js scripts. If I uncheck this setting, the theme URLs all begin with http:// because my site is not running with SSL.

    If your plugin could have a similar feature - just a checkbox to let me use one or the other - then it would allow for all possibilities. This will be fully compliant with WordPress core. :)

    What do you think?

  4. Jason Penney
    Member
    Plugin Author

    Posted 9 months ago #

    You are correct. My mistake. I've tried to avoid having any options in the plugin to date, but it seems like a reasonable request.

    If you have github account, you could file an enhancement request on the tracker (If you don't have an account I can file it, but you won't get email updates).

  5. GermanKiwi
    Member
    Posted 9 months ago #

Reply

You must log in to post.

About this Plugin

  • Use Google Libraries
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.