PDA

View Full Version : Dynamicly injecting elements into the head



ReSpawNnL
11 Jun 2010, 2:01 AM
Hi guys,

I've successfully injected my elements in the head using Ext.fly and getting the head object. Now comes the trouble.
Firefox works fine, but all Webkit based browsers refuse to execute the dynamicly injected scripts. Why? I don't know. I've got a small test.js file that only says alert('Hi!'); and even that doesn't work. Even wrapping that inside the Ext.onReady() or Ext.onReady(function(){}); doesn't do anything. Perhaps I am missing something?

ReSpawN

Condor
11 Jun 2010, 3:05 AM
It needs a bit more work to make it cross-platform compatible.

The easiest solution is to include ext-3.2.1/src/ext-core/src/core/Loader.js (not part of ext-all.js) and use:

Ext.Loader.load(['test.js']);

ReSpawNnL
11 Jun 2010, 3:28 AM
Gonna try that out! I already though the option wasn't available to me just yet... Ah well, perhaps this will work! I hate to load like 10 scripts if I don't need them (eg: syntax highlighting, highlight and so forth)