Click here to Skip to main content
15,910,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a SharePoint site Page in which i need to put an iFrame element to display a web page.To achieve that I wrote some html and javascript within CDATA tag inside the Content section of a ContentEditorWebPart as follows.


XML
<Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">
<![CDATA[
<iframe width="100%" id="mySitecontainer" src="https://mywebsite/Login.aspx?loguser=" frameborder="0" > </iframe>
<script type="text/javascript">
    var lusr = getLoggedUser();
    var requiredUrl = "https://mywebsite/Login.aspx?loguser=" + lusr;
    $('#mySitecontainer').attr('src',requiredUrl);
</script>
]]>
</Content>


Here the 

getLoggedUser() function is inside an external js file for which I have added a reference earlier.Now the problem is the above script is not working sometimes, especially whenever I refresh the SharePoint site page in the browser and the src of the above iFrame element is being rendered without any querystring parameter(loguser in this case). Can someone help me where I did wrong here?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900