without the ,0 in the RequiresJS method, the client dependency framework will load the scripts in the order they appear on the page, minimise the scripts in each file, and make them available in a single request.
the ,0 controls their order so my first thought is to use:
this would mean that Jquery would definately be presented before bootstrap.
So what could be going wrong ?
Everything could be fine, but the problem cached - make sure you increase the version number of the Client Dependency Framework in /config/clientdependencyframework.config
also if you are working locally and have compilation debug set to true in your web.config, then the client dependency framework does not perform the minimising. So if it works in these circumstances but not in a production environment (eg where compilation debug is set to false) the the problem may lie in the minimising process (I've had odd spaces and characters causing issues in the past) - the way to troubleshoot this is to visit the generated dependencyhandler.axd?s=asdfsadfsa url directly in your browser and determine whether all of your content is there, usually the point at which it stops, is the point where the problem is.
When viewing the minimised file directly in the browser, I often add &v=2 on the end, so I can be sure I'm not viewing a version cached by the browser.
Client dependency loading order
Hello all,
I have a problem with some bootstrap js, I found the cause of the problem, right now I am loading the js files like this:
And that is not working, but if i take the bootstrap.min.js and make it like a normal html script like this:
Then it works, so my question is.... why?
Of my understanding the 0 in the Html.RequireJs means that it should load this file first, or am I totally wrong?
Hi Henrik
without the ,0 in the RequiresJS method, the client dependency framework will load the scripts in the order they appear on the page, minimise the scripts in each file, and make them available in a single request.
the ,0 controls their order so my first thought is to use:
this would mean that Jquery would definately be presented before bootstrap.
So what could be going wrong ?
Everything could be fine, but the problem cached - make sure you increase the version number of the Client Dependency Framework in /config/clientdependencyframework.config
also if you are working locally and have compilation debug set to true in your web.config, then the client dependency framework does not perform the minimising. So if it works in these circumstances but not in a production environment (eg where compilation debug is set to false) the the problem may lie in the minimising process (I've had odd spaces and characters causing issues in the past) - the way to troubleshoot this is to visit the generated dependencyhandler.axd?s=asdfsadfsa url directly in your browser and determine whether all of your content is there, usually the point at which it stops, is the point where the problem is.
When viewing the minimised file directly in the browser, I often add &v=2 on the end, so I can be sure I'm not viewing a version cached by the browser.
regards
Marc
Hi Marc,
Thanks for your advise,
I tried to use the solutions you gave me, but with no luck :(
Now it's ordered like you said:
And I increased my ClientDependency version by 1.
I am working "locally" on my server, with IIS, I tried to change the debug="false", but it still doesn't work for me.
I don't get the "dependencyhandler.axd?s=" thing, what should be in the query after "?s=" ?
I found the problem.
I had a @Html.RenderJsHere() at the button of the body, i removed that and that solved the problem.
Hi Henrik
So it was rendering out your Javascript twice!!
great you got it working!
cheers
Marc
is working on a reply...