Domanda

Sharpeoint 2013 ha un modello di filtro predefinito situato a:

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

Come posso leggere il percorso assoluto della masterpage _catalogs in c #?

Esempio di percorso assoluto: http://mymachine/_catalogs/masterpage/Display%20Templates/Filters/Filter_Default.js

Quindi, se caricherò questo file in un elemento di script HTML, non riceverò un errore 404 non trovato nel browser:

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

È stato utile?

Soluzione

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)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top