SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to have the text file associated with my content editor change based upon the query string.


Content Editor link: /site assets/[QueryStringResult].txt

share|improve this question
I am not aware of anyway to do this but you could achieve the same result by adding some jQuery to your text file which altered the output based on the query string parameter? – Dave Paylor Mar 15 '13 at 21:59
Dave, Thank you. Yes, These documents already exsists, so I was just hoping there was a way to utilize the existing files. But there is possibly not away to do this. Thanks again – Shelly Miner Mar 16 '13 at 0:52

It could be achieved by generating url for the asset on the client side and passing it to iframe for displaying asset content in Content Editor web part.


Clear ContentLink property

Put in Content property of the following code:

<iframe width="100%" id="assetContent"  frameborder="0"></iframe>

<script type="text/javascript">

//get query string value
function getParameterByName(name)
  name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
  var regexS = "[\\?&]" + name + "=([^&#]*)";
  var regex = new RegExp(regexS);
  var results = regex.exec(;
  if(results == null)
    return "";
    return decodeURIComponent(results[1].replace(/\+/g, " "));

function renderAssetContent() 
    var division = getParameterByName("division");
    if (division.length > 0){
        var assetUrl = "/teamsite/itdepteamsite/SiteAssets/" + division + ".txt"; 

        var assetContent = document.getElementById("assetContent");
        assetContent.setAttribute("src", assetUrl);

share|improve this answer

Your Answer


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.