1
I’m having trouble at the moment to add a Script dynamically on a page.
The script I want to add is from CKEDITOR (Text editor).
I am able to add the Script, but I cannot access the object of this Script after this action, the object that is created is the CKEDITOR.
var script = document.createElement("script");
script.type = "text/javascript";
script.async = true; // Testei true e false e nada!
script.src = "objs/ckeditor/ckeditor.js";
document.getElementsByTagName("head")[0].appendChild(script);
When I try to print the object, the message that returns is undefined object.
Does anyone have any suggestions ?
That file
ckeditor.js
exports to global space? what is the object you are trying to access and how?– Sergio
@Sergio after the page fully loads exports the CKEDITOR object, but before the page finishes loading I use this code to exbir the objects of Document for( object in window ){ console.log(object); } but the CKEDITOR does not appear at this time, only after.
– Renan Santos
if you do
console.log(window.CKEDITOR);
within the callback function that Tobymosque suggested, which gives you?– Sergio