disable mixed content via javascript

JavaScript
//there's no way to disable mixed content using javascript but you can add this tag
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
//to your HTML to allow mixed content

Source

Also in JavaScript: