Converting Linked Resources to HTTPS Upon Loading the Document Page Using jQuery

This is just a separate post to modifying linked resources to HTTPS when using DOM.

jQuery( document ).ready(function($) {
    // This will find links for `href` attributes and substitute url value
    str.replace(/(href[^http://]+)(?<=['\"])http(?=://)/gi, "$1https")

   // This will look for `src` attributes particularly images, JS scripts and replace the url value
    str.replace(/(src[^http://]+)(?<=['\"])http(?=://)/gi, "$1https");

    // Find forms and look for `action` attributes and replace url value
    str.replace(/(action[^http://]+)(?<=['\"])http(?=://)/gi, "$1https");
});

Feel free to comment below;

Converting Linked Resources to HTTPS Upon Loading the Document Page Using jQuery1.20/5 (24.00%) 5 votes
About

Elvin is one of the contributors of InnoveDesigns.com. He has been creating Wordpress Plugins, Magento Extensions, & Mobile Applications. If you find this article useful, please Follow him on .

Published under Web Development Guide