Skip to main content
Tweeted twitter.com/#!/StackSharePoint/status/483386031862214656
Just added some tags for increased visibility
Link
Jesus Shelby
  • 10.9k
  • 25
  • 52
deleted 50 characters in body
Source Link
Robert Lindgren
  • 24.5k
  • 12
  • 53
  • 79

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

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.

<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 adde 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.

                                  Thanks in Advance

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.

<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?

Source Link

How to put an iFrame with a QueryString appended in its src in the ContentEditorWebPart?

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.

<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 adde 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.

                                  Thanks in Advance