I have a SharePoint site Page in which i need to put an iFrame element to display a web page.To achieve that iI wrote some html and javascript within CDATA tag inside the Content section of a ContentEditorWebPart as follows.
<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()getLoggedUser()
function is inside an external js file for which iI have addeadded a reference earlier.
Now the problem is the above script is not working sometimes, especially whenever iI refresh the sharepointSharePoint 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 iI did wrong here.?
Thanks in Advance