Question

I'm trying to load a script with the firebug console like this:

var script = document.createElement('script');
script.src = 'http://code.jquery.com/jquery-latest.js'; //example
document.getElementsByTagName("head")[0].appendChild(script);

When I run that code the firebug console gives me the error,

Blocked loading mixed active content "http://code.jquery.com/jquery-latest.js"

Is there a way to get around that?

I don't necessarily need to load jquery. The ability to insert scripts with firebug would be useful for development.

Was it helpful?

Solution 2

Mixed content suggests that you are loading your script from an external source served over http onto your page which is server over https

So, you can use this

script.src = https://code.jquery.com/jquery-latest.min.js;

Here is a related mozilla documentation.

OTHER TIPS

As an alternative solution, Firebug's command line allows you to do include("http://code.jquery.com/jquery-latest.js");

(But https is a good idea in any case.)

For security reasons, you cannot load scripts from HTTP in an HTTPS page.

Change the script URL to HTTPS.

Consider the include() command, with which you can do what you want and you can even manage aliases to include your favorite scripts.

Note that by default, include() proposes the "jquery" alias to get jquery-latest. So would just have to use this command:

include("jquery")

Here is the documentation: https://getfirebug.com/wiki/index.php/Include

Florent

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top