Relative URL or using _spPageContextInfo
-
20-02-2021 - |
Pregunta
For some reason, relative URLs are not working OR I am using the wrong syntax. I have tried the following with no luck on my CEWP HTML page.
<script src="/jslib/jquery351/jquery351.min.js"></script>
<script src="../jslib/jquery351/jquery351.min.js"></script>
<script src="/../jslib/jquery351/jquery351.min.js"></script>
<script src="/.../jslib/jquery351/jquery351.min.js"></script>
<script src=".../jslib/jquery351/jquery351.min.js"></script>
<script src="~jslib/jquery351/jquery351.min.js"></script>
I was thinking of using the _spPageContextInfo.siteAbsoluteUrl function but I'm having issues implementing it into the HTML page to dynamically create the src string dynamically and having absolute URLs for test and production is getting old.
In a previous job, these worked so I'm wondering if this is a server setting out of curiosity.
Thanks.
Solución
Try this
<script src="../../jslib/jquery351/jquery351.min.js"></script>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a sharepoint.stackexchange