if(location.href.includes('https')){ $('#httpRequest').attr('http-equiv','Content-Security-Policy') $('#httpRequest').attr('content','upgrade-insecure-requests') }else{ $('#httpRequest').attr('http-equiv','') $('#httpRequest').attr('content','') }