I have a webpart and I want to reference a js file in the content link. But I don't want to hardcode the full absolute path. I want to use the relative url. The js is located in the style library folder.
The problem is I can't find out how to use the relative path. I tried
But then this breaks if I use this same link in a subsite. Because the number of
.. is changed. I want a link that will work from anywhere. I tried
but SharePoint doesn't evaluate the
~ variable into the path. Does anyone know how to do this? Thanks.