0

I have a popup window in our SharePoint online that can be visible all over the SharePoint and should be displaying the information about current site like Administrator, Purpose, ...etc. The problem I have is how to dynamically update the content of this popup. The idea is to have a file "info.html" saved in each site within site collection in the siteassets folder and the content will be loaded from there but I can't find a way how to write a relative URL to https://...sharepoint.com/sites/applications/deadair/siteassets/info.html. (All sites are in "Applications" site collection).

I'm able to get the info I need from the external file using absolute path via

$("#Author").load("https://...sharepoint.com/sites/applications/deadair/SiteAssets/info.html #AuthorName"); 

but need to have this written in the way it looks for info.html in the current site/siteassets. Something like: $("#Author").load("https://...sharepoint.com/sites/applications/[CurrentSite]/SiteAssets/info.html #AuthorName");

The other approach would be to have all info.html files saved in the style library in the root of the site collection and they will be named the same as the site they refer to but also can' t find a way how to reference relative filename according to the location in URL. Something like

$("#Author").load("https://...sharepoint.com/sites/applications/stylelibrary/[CurrentSiteName].html #AuthorName"); 

Hope my explanation makes any sense and thanks for any help.

1

There is a global variable called L_Menu_BaseUrl that contains the relative path to the current site.

So, this should work:

$("#Author").load(L_Menu_BaseUrl + "/SiteAssets/info.html #AuthorName"); 
1
  • Thank you! This was exactly what I was looking for. Works exactly how it's supposed to. – Jozef Simonak Sep 21 '16 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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