Skip to main content
Copy edited (e.g. ref. <http://en.wikipedia.org/wiki/Uniform_resource_locator> and <http://english.stackexchange.com/questions/4645/is-it-ever-correct-to-have-a-space-before-a-question-or-exclamation-mark#comment206109_4645>).
Source Link

how How to reference the Site Collection URL inside the src attribute

I added a custom script to my "Style Library" folder under a site collection , the. The site collection urlURL is as follow http://servername/HR. soSo to reference the script inside my master page iI wrote the following  :-

<script  type="text/javascript" src="/hr/Style%20Library/Custom JS/HideTreeViewFolder.js" ></script>

where iWhere I am manually referencing the /hr/ in sideinside the src, so can iI make this more dynamic and get the site collection urlURL dynamically, so if iI move the site collection to another URL the script will still get referenced  ?

how to reference the Site Collection URL inside the src attribute

I added a custom script to my "Style Library" folder under a site collection , the site collection url is as follow http://servername/HR. so to reference the script inside my master page i wrote the following  :-

<script  type="text/javascript" src="/hr/Style%20Library/Custom JS/HideTreeViewFolder.js" ></script>

where i am manually referencing the /hr/ in side the src, so can i make this more dynamic and get the site collection url dynamically, so if i move the site collection to another URL the script will still get referenced  ?

How to reference the Site Collection URL inside the src attribute

I added a custom script to my "Style Library" folder under a site collection. The site collection URL is http://servername/HR. So to reference the script inside my master page I wrote the following:

<script  type="text/javascript" src="/hr/Style%20Library/Custom JS/HideTreeViewFolder.js" ></script>

Where I am manually referencing the /hr/ inside the src, so can I make this more dynamic and get the site collection URL dynamically, so if I move the site collection to another URL the script will still get referenced?

Tweeted twitter.com/#!/StackSharePoint/status/616276380637130752
deleted 250 characters in body
Source Link
John John
  • 1
  • 49
  • 258
  • 603

I added a custom script to my "Style Library" folder under a site collection , the site collection url is as follow http://servername/HR. so to reference the script inside my master page i wrote the following :-

<script  type="text/javascript" src="/hr/Style%20Library/Custom JS/HideTreeViewFolder.js" ></script>

where i am manually referencing the /hr/ in side the src, so can i make this more dynamic and get the site collection url dynamically, so if i move the site collection to another URL the script will still get referenced ?

now i tried adding ".." sand seems it will correctly reference the folder inside the site collection,, but not sure if this is valid ?

  <script  type="text/javascript" src="../Style%20Library/Custom JS/HideTreeViewFolder.js" ></script>

I added a custom script to my "Style Library" folder under a site collection , the site collection url is as follow http://servername/HR. so to reference the script inside my master page i wrote the following :-

<script  type="text/javascript" src="/hr/Style%20Library/Custom JS/HideTreeViewFolder.js" ></script>

where i am manually referencing the /hr/ in side the src, so can i make this more dynamic and get the site collection url dynamically, so if i move the site collection to another URL the script will still get referenced ?

now i tried adding ".." sand seems it will correctly reference the folder inside the site collection,, but not sure if this is valid ?

  <script  type="text/javascript" src="../Style%20Library/Custom JS/HideTreeViewFolder.js" ></script>

I added a custom script to my "Style Library" folder under a site collection , the site collection url is as follow http://servername/HR. so to reference the script inside my master page i wrote the following :-

<script  type="text/javascript" src="/hr/Style%20Library/Custom JS/HideTreeViewFolder.js" ></script>

where i am manually referencing the /hr/ in side the src, so can i make this more dynamic and get the site collection url dynamically, so if i move the site collection to another URL the script will still get referenced ?

Source Link
John John
  • 1
  • 49
  • 258
  • 603

how to reference the Site Collection URL inside the src attribute

I added a custom script to my "Style Library" folder under a site collection , the site collection url is as follow http://servername/HR. so to reference the script inside my master page i wrote the following :-

<script  type="text/javascript" src="/hr/Style%20Library/Custom JS/HideTreeViewFolder.js" ></script>

where i am manually referencing the /hr/ in side the src, so can i make this more dynamic and get the site collection url dynamically, so if i move the site collection to another URL the script will still get referenced ?

now i tried adding ".." sand seems it will correctly reference the folder inside the site collection,, but not sure if this is valid ?

  <script  type="text/javascript" src="../Style%20Library/Custom JS/HideTreeViewFolder.js" ></script>