none
Using ScriptSrc to reference a javascript on publishing site breaks the Asset Picker dialog? RRS feed

  • Question

  • I'm using a site scoped feature to add a reference to jquery.js:

    <CustomAction
      ScriptSrc="MyScrips/jquery-1.4.2.min.js"
      Location="ScriptLink"
      Sequence="100"
          >
     </CustomAction>

    After activating the feature for a publishing site I no longer can insert a picture from Sharepoint. The Asset Picker dialog throws a script error when I select an image:

    Line: 3377
    Char: 5
    Error: 'style' is null or not an object'
    Code: 0
    Url: http://www.mysitename.com/_layouts/1033/cmssitemanager.js 

    My workaround is to add the .js reference directly in the masterpage instead, that does not affect the Asset picker. The error is easilly reproduced on my development server + a production server. I'm hoping anyone else has solved the issue because I would really like to use the cool ScriptSrc also for publishing sites.

    Regards,
    ElinK

    Tuesday, September 21, 2010 2:19 PM

Answers

  • Hi,

    You are correct - another workaround would be to reference the .js files in a delegate control inserted into e.g AdditionalPageHead control. This is still a workaround, and I would prefer to be able to use the new ScriptSrc functionality.

    Regards,

    ElinK

    • Marked as answer by Wayne Fan Monday, October 11, 2010 9:10 AM
    Thursday, September 23, 2010 9:04 AM

All replies

  • Hi Elink,

     

    Thanks for your post.

     

    Instead of adding the js reference to the master page, have you considered about adding js reference to the DelegateControl?

     

    More information:

    http://msdn.microsoft.com/en-us/library/ms470880.aspx

    http://vspug.com/mrbill/2007/05/24/using-delegate-controls-in-sharepoint/

     

    Share your views.

    Thursday, September 23, 2010 8:58 AM
  • Hi,

    You are correct - another workaround would be to reference the .js files in a delegate control inserted into e.g AdditionalPageHead control. This is still a workaround, and I would prefer to be able to use the new ScriptSrc functionality.

    Regards,

    ElinK

    • Marked as answer by Wayne Fan Monday, October 11, 2010 9:10 AM
    Thursday, September 23, 2010 9:04 AM
  • We have started to notice that we are now getting this same error message when trying to use the asset picker; however we have not added any new Custom Actions to the sites. We have that this is due to us activating the DevDashVisScripts_V2 which provide a JQuery graphical representation of the Dev Dashboard page load details - deactivating this feature resolves the problem; is this something to do with JQuery only or all script libraries??
    Tuesday, October 12, 2010 7:39 AM
  • Hello,

    I know this is an older entry but I had a similar issue just some weeks ago.

    In my case I am using jquery-1.7.1.min and got similar exceptions due to the sequence number specified in the customaction. I simply used a higher sequence number (50000) and the exception was not occurring anymore.

    Please note that you need to use jQuery.noConflict() with SharePoint 2010 publishing pages (or at least change the $ sign addressing). There are some know issues with the AssetBrowser like described here 

    br,

    patrick



    follow me if you want on:
    my blog http://www.lamber.info
    Twitter: @patricklamber

    Saturday, June 9, 2012 4:47 AM