copyright from: http://blog.lekman.com
When publishing a custom action for registering jQuery or another external script via ScriptLink, you might get a blank white page.
<CustomAction Id="LoadJQuery" ScriptSrc="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" Location="ScriptLink" Sequence="100" />Sample 1: External script link that will not render correctly
Based on this it will look for a folder called "Scripts" inside of your "15/TEMPLATE/LAYOUTS" folder. This will only work if the solution is full trust since the sandbox will not have access.
To get around the issue, you must deploy the file to the local SPWeb and reference the file using the relative handler “~site”.
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <CustomAction Id="LoadJQuery" ScriptSrc="~site/script/jquery-1_8_3_min.js" Location="ScriptLink" Sequence="100" /> <Module Name="ScriptRegistration"> <File Path="script\jquery-1_8_3_min.js" Url="script/jquery-1_8_3_min.js" /> </Module> </Elements>Sample 2: Complete elements declaration of internal referenced script link that will render correctly.
No comments:
Post a Comment