Skip to content

Instantly share code, notes, and snippets.

@kovtunos
Created February 18, 2017 06:49
Show Gist options
  • Select an option

  • Save kovtunos/bf720f788f7999d653ed9db023d34398 to your computer and use it in GitHub Desktop.

Select an option

Save kovtunos/bf720f788f7999d653ed9db023d34398 to your computer and use it in GitHub Desktop.
HTTP to HTTPS with #jquery #js
// var 1
$('a[href^="http://"]').attr('href', function(i, oldhref){
oldhref.replace("http://","https://")
});
// var 2
$('a[href^="http://"]').each(function(){
$(this).attr('href', $(this).attr('href').replace("http://","https://"))
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment