I am trying to building a XSS widget and am having issues with Webkit browsers loading the external javascript files which I am appending into the dom. It works as below:
- Widget.js appends 3 javascript files into the dom (jquery, data, content)
- Jquery.js is standard jquery with a custom namespace
- Data.js is a javascript array
- Content.js is a set of jQuery instructions to build the widget based off the data in Data.js
In firefox the browser does exactly 100% of the time what im telling it and the widget loads where ever you placed the include javascript on the page.
However in Webkit ie Safari, the browser returns the 3 files in a random order, and executes once returned. This means that when Content.js looks for $ to do jquery magic it fails. Likewise if jQuery is available and it loads the data late if fails due to lack of data.
Suggestions please?