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

Currently I am trying to reference my SiteCollection Style Library image directory in a javascript file linked up to a DocumentLibrary Webpart in a subsite.

The current directory I am attempting to do this is

 src="/Style Library/images/'

I believe this should have worked as I replicated the xlsx icon generation by using

src="/_layouts/15/images/icxlsx.png"

Well I just cut and pasted the html src to my Sitecollection webpath and I am able to get the image to show up so currently I am unaware of what the issue is.

share|improve this question

1 Answer 1

Ahh ha I found out the answer.

The path

src="/_layouts/15/images/icxlsx.png"

point to the host web path of

https://yoursite.sharepoint.com/_layouts/15/images/icxlsx.png

If you wish to access a sitecollection Style Library then you will need to add that onto the url such as

/Sites/Style library/ ...      

or what ever you have named your site collection. Now the weird thing about this is that the tolken for JSLink you can only use

~controlTemplates ~layouts ~site ~sitecollection

http://msdn.microsoft.com/en-us/library/office/ms431831(v=office.15).aspx

I believe then this means that if you wish to use the JSLink to a javascript file on your host site when you are on a different sitecollection you will have to use the full https:// url path to your javascript file.

Kinda silly but hopefully one day they will give us a token that will allow a quick reference to the host web of your site.

share|improve this answer

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.