Click here to Skip to main content
15,882,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I've a situation were i need to load few scripts before document is loaded (ready state). Ony of my script contains a line document.write(). It is overriding the document. But i want it to load first then the document , so that both stays on the page.

Any suggestions on this? (provided: i want to load all my scripts using requirejs)
Posted
Updated 9-Dec-14 1:50am
v2
Comments
ZurdoDev 9-Dec-14 8:09am    
You want the document.write() js to run first? Add that in your aspx page as the first script you reference. Do it at the top of the page in the head. See if that helps.
[no name] 9-Dec-14 22:56pm    
Actually my scenario is - i'm creating a knockout component which has viewModel and template fields, the template creation is something like it will call document.write internally to write the template into document. So here i'm facing an issue that scripts are loaded after document is ready which the template gets overridden with current document, which i don't want to happen. One way i can solve the issue is load the component part before require js scripts, but the component depends on knockout to be loaded first. so if i need to load knockout first, then component then requirejs and other modules but by loading knockout js separately i'm missing the usage of require js to load all scripts. So i want to load all scripts with require js and also using the advantage of loading my component before dom ready.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900