Solved

SharePoint MasterPage and Javscript error

Posted on 2013-01-05
5
728 Views
Last Modified: 2013-01-13
Hello all,

I'm working on a client request to allow them to edit a mission statement place in the header and edit the footer. What comes to mind to allow this to happen is using SPServices to show the information from a list. Right now, instead of placing javascript file it in a CEWP, I wanted place it in the masterPage so that it can carry through out the website. Unfortunately, I keep getting errors when I try to reference my javascript file.

I get a "Cannot make a cache safe URL" when I reference use <SharePoint:ScriptLink>, a "Syntax Error" when using a <script> tag and it doesn't show up at all when I reference the the file in <asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server"> tag. Thanks

I'm using a javascript test file that has an alert("I'm in"); that I have tested and I know it works. I may be missing something on how to reference a javascript file in a SharePoint masterpage. Please let me know if I'm doing something wrong.
0
Comment
Question by:Isaac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 32

Accepted Solution

by:
Jamie McAllister MVP earned 250 total points
ID: 38748201
Would the Reusable Content list be a valid alternative approach?

http://office.microsoft.com/en-001/sharepoint-server-help/use-reusable-content-HA010163838.aspx

As for your issue above, there are several possible causes listed here;

http://www.enjoysharepoint.com/Articles/Details/cannot-make-a-cache-safe-url-for-filename-file-not-194.aspx
0
 
LVL 5

Author Comment

by:Isaac
ID: 38749332
Error on pageThanks but I don't think reusable content will be an approach I will pursue. Even when I reference the js file correctly, I get a syntax error. Attach is want I'm receiving.
0
 
LVL 32

Expert Comment

by:Jamie McAllister MVP
ID: 38750139
I've seen this before when the encoding was different. Open your file in Notepad and try saving it as ANSI and UTF8 and see if that changes things. Failing on the first character can hint at something like that.
0
 
LVL 14

Assisted Solution

by:KoenVosters
KoenVosters earned 250 total points
ID: 38750164
I would first of all work with a delegate control where you plug in the javascript:

http://fyeomans.com/2011/05/16/make-your-sharepoint-2010-master-page-extensible-with-delegate-controls/
0
 

Expert Comment

by:Officelabs_LarryK
ID: 38762367
I'm not sure why you would use SPServices when a straight forward dataview webpart would do the same job here.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Add Rows on a Table 8 51
Angular2 remove duplicates 11 24
Can't see json data in ajax call to Highcharts 2 28
carousel control extend past the images 9 26
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question