Title: How get scripts to enqueue via https?
Last modified: August 21, 2016

---

# How get scripts to enqueue via https?

 *  Resolved [joshuaiz](https://wordpress.org/support/users/joshuaiz/)
 * (@joshuaiz)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/how-get-scripts-to-enqueue-via-https/)
 * I just installed SSL for my checkout page but Ajaxize does not recognize this
   and is enqueueing the scripts via http and thus they won’t load on any https 
   pages.
 * How can I change the following for Ajaxize to recognize https:
 * define( ‘PLUGIN_DIR’, dirname(__FILE__).’/’ );
 * wp_enqueue_script ( “ajaxize_this”, path_join(WP_PLUGIN_URL, basename( dirname(
   __FILE__ ) ).”/ajaxize_this.js”), array( ‘jquery’, ‘jquery-query’ ) );
 * Thanks!
 * [https://wordpress.org/plugins/ajaxize/](https://wordpress.org/plugins/ajaxize/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [yoav.aner](https://wordpress.org/support/users/yoavaner/)
 * (@yoavaner)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/how-get-scripts-to-enqueue-via-https/#post-5133156)
 * Hi joshuaiz,
 * As far as I know this plugin should work seamlessly with HTTP/HTTPS. Perhaps 
   the reason you see the enqueued scripts served via http because of some kind 
   of caching?
 * Cheers
    Yoav
 *  Thread Starter [joshuaiz](https://wordpress.org/support/users/joshuaiz/)
 * (@joshuaiz)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/how-get-scripts-to-enqueue-via-https/#post-5133158)
 * I’m using WP Super Cache but even with the cache totally cleared and/or the plugin
   deactivated still getting the warning in Chrome.
 * The ajaxified divs don’t load at all on my Checkout page which is the only page
   that uses SSL/https.
 * This is the message in Chrome:
 * [blocked] The page at ‘[https://vizualrecords.com/store/checkout/&#8217](https://vizualrecords.com/store/checkout/&#8217);
   was loaded over HTTPS, but ran insecure content from ‘[http://vizualrecords.com/wp-content/plugins/ajaxize/ajaxize_this.js&#8217](http://vizualrecords.com/wp-content/plugins/ajaxize/ajaxize_this.js&#8217);:
   this content should also be loaded over HTTPS.
 *  Plugin Author [yoav.aner](https://wordpress.org/support/users/yoavaner/)
 * (@yoavaner)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/how-get-scripts-to-enqueue-via-https/#post-5133160)
 * `wp_enqueue_script` does not specify whether the script is loaded via http or
   https, it relies on wordpress to load it using the way the site is loaded.
 * I would recommend checking your wordpress settings and make sure everything is
   configured correctly to use https.
 *  Thread Starter [joshuaiz](https://wordpress.org/support/users/joshuaiz/)
 * (@joshuaiz)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/how-get-scripts-to-enqueue-via-https/#post-5133163)
 * Thanks Yoav.
 * After trying several solutions including the WordPress HTTPS (SSL) plugin which
   didn’t work at all, using the [SSL Insecure Content Fixer](http://wordpress.org/plugins/ssl-insecure-content-fixer/)
   plugin did the trick.
 * I’m also using this script from Yoast:
 *     ```
       function yst_ssl_template_redirect() {
       	if ( is_page( 123 ) && ! is_ssl() ) {
       		if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {
       			wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']), 301 );
       			exit();
       		} else {
       			wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 301 );
       			exit();
       		}
       	} else if ( !is_page( 123 ) && is_ssl() && !is_admin() ) {
       		if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {
       			wp_redirect(preg_replace('|^https://|', 'http://', $_SERVER['REQUEST_URI']), 301 );
       			exit();
       		} else {
       			wp_redirect('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 301 );
       			exit();
       		}
       	}
       }
       add_action( 'template_redirect', 'yst_ssl_template_redirect', 1 );
       ```
   
 * So that only my Checkout page needs SSL and you don’t have to change your site/
   home URL to https. Hopefully this helps someone else.
 *  Plugin Author [yoav.aner](https://wordpress.org/support/users/yoavaner/)
 * (@yoavaner)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/how-get-scripts-to-enqueue-via-https/#post-5133164)
 * Thanks for the info.
 * If you already have a certificate installed, I would personally recommend using
   SSL everywhere across your website. It increases security and gives people confidence
   with your website, without really affecting performance as much as people might
   think.
 * Just my 2 cents.
 *  Thread Starter [joshuaiz](https://wordpress.org/support/users/joshuaiz/)
 * (@joshuaiz)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/how-get-scripts-to-enqueue-via-https/#post-5133165)
 * Hi Yoav,
 * Yes I’m working towards that but with a separate server delivering static resources
   I will have to get another cert to make everything work but that’s the plan.
 * Thanks for the help!
 *  Plugin Author [yoav.aner](https://wordpress.org/support/users/yoavaner/)
 * (@yoavaner)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/how-get-scripts-to-enqueue-via-https/#post-5133166)
 * Ok, no problem. Just pointing this out.
 * You could also consider using a CDN for static resources (which your caching 
   plugin might already support). Most CDNs support both http and https. Just a 
   suggestion, in case it helps in any way.
 * In any case, hope you enjoy using Ajaxize and best of luck with the migration
   to HTTPS.
 * Cheers
    Yoav

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘How get scripts to enqueue via https?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/ajaxize.svg)
 * [Ajaxize](https://wordpress.org/plugins/ajaxize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajaxize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajaxize/)
 * [Active Topics](https://wordpress.org/support/plugin/ajaxize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajaxize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajaxize/reviews/)

## Tags

 * [enqueue scripts](https://wordpress.org/support/topic-tag/enqueue-scripts/)
 * [HTTPS](https://wordpress.org/support/topic-tag/https/)
 * [SSL](https://wordpress.org/support/topic-tag/ssl/)

 * 7 replies
 * 2 participants
 * Last reply from: [yoav.aner](https://wordpress.org/support/users/yoavaner/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/how-get-scripts-to-enqueue-via-https/#post-5133166)
 * Status: resolved