• Resolved joshuaiz

    (@joshuaiz)


    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/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author yoav.aner

    (@yoavaner)

    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

    (@joshuaiz)

    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/’ was loaded over HTTPS, but ran insecure content from ‘http://vizualrecords.com/wp-content/plugins/ajaxize/ajaxize_this.js’: this content should also be loaded over HTTPS.

    Plugin Author yoav.aner

    (@yoavaner)

    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

    (@joshuaiz)

    Thanks Yoav.

    After trying several solutions including the WordPress HTTPS (SSL) plugin which didn’t work at all, using the 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

    (@yoavaner)

    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

    (@joshuaiz)

    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

    (@yoavaner)

    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.