Javascript error
Hi,
I've converted a normal ASP.NET website to SF4.0.
One masterpage and one normal page.
On this masterpage I included two links:
1. Link to Jquery library
2. Link to custom jquery functions (main.js) (slider functionality)
In the normal website, all is rendered as expected and all is working okay.
When converting all to SF4.0 I'm getting an error inside my main.js file that the object doesn't exists?
I cannot figure out why this is happening. All code is exactly the same.
I did the same thing in SF3.7 and there it wokrs okay?
So, a little confused...
Any idea's?
Regards,
Daniel
When using the <sf:JavascriptEmbedControl /> the script is rendered in the <head> section like this:
<
script
type
=
"text/javascript"
src
=
"~/Assets/js/jquery.main.js"
></
script
>
Okay, so I got it working by doing this:
<
sf:JavaScriptEmbedControl
ID
=
"jquery"
runat
=
"server"
ScriptEmbedPosition
=
"BeforeBodyEndTag"
Url
=
"Assets/js/jquery.main.js"
>
</
sf:JavaScriptEmbedControl
>
Hello Daniel,
Thank you for using our services.
The problem with using application relative path in the Url has been logged as bug (#107996). For now you should use rooted path (starting with "/" from the website root) or use full Url starting with "http://".
Unfortunately this control does not allow to link the JavaScript libraries which ship with Sitefinity. I have logged a product backlog item (#108035) to extend the control to allow for selection of a number of JS libraries.
Kind regards,
Radoslav Georgiev
the Telerik team
Thanks Daniel,
I've been dealing with odd javascript errors saying things like my function is not defined. I was using the Javascript widget and telling it to put my js reference in the Head but I could never get my js to work. Your suggestion to place the reference before the Body end tag did the trick.
Michael