0

The .js file is loaded in aspx page like this:

<SharePoint:ScriptLink runat="server" ID="script1" name="/js/my.js" Localizable="false" />

And when page is loaded throws javascript exception

Type is not defined

EDIT This script load line works:

<script src="/_layouts/js/my.js"/>

The ScriptLink control produces correct <script> link,the problem is that its placed higher in the page then some of the other SharePoint scripts.

0

I think that you add incorrect reference to the JS file. See this post to understand the common practice.

0

Did you try putting the javascript code inside a Content Query Web Part on that page?

0

BothScriptLink and native

<script src="/_layouts/js/my.js"/>

works, though ScriptLink control transformed HTML code is placed higher in the page then SharePoint SOD scripts that my.js depends on -> it executes before SP SOD scripts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.