Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sharpeoint 2013 has a default filter template located at:

_catalogs/masterpage/Display%20Templates/Filters/Filter_Default.js

How can I read the absolute path of the _catalogs masterpage in C# ?

Example of absolute path : http://mymachine/_catalogs/masterpage/Display%20Templates/Filters/Filter_Default.js

so, if I'll load this file in a html script element, I will not get a 404 Not found error in the browser:

<script type="text/javascript" src="http://mymachine/_catalogs/masterpage/Display%20Templates/Filters/Filter_Default.js">
</script>
share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

Why would you not use the fact that _catalogs is a virtual directory in SharePoint and reference it like this:

<scrit type="text/javascript" src="/_catalogs/15/masterpage/Display%20Templates/Filters/Filter_Default.js">
</script>

(notice the slash at first, and the 15 telling Sharepoint to look at the 15 hive instead of the 14 hive from 2010)

I also notice you have a typo in your "type" attribute (javscript instead of javascript)

share|improve this answer
    
Perfect, it works, thank you –  Bogdan M. May 9 '13 at 15:22
    
Glad to help, please mark as the answer :) –  Robert Lindgren May 9 '13 at 15:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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