Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, October 21, 2014 2:44 PM
We're seeing an issue with several of our pages and several pieces of code we're adding to sites that is causing some headaches. We have code on our main, root SharePoint page that redirects users to their division's homepage and on our HR page for an in-window healthcare provider lookup. Whenever either of these pages are edited, the code is destroyed and we have to re-enter the code. Here is where it gets really frustrating:
Sometimes re-entering the code fixes the issue.
Sometimes re-entering the code breaks the way it broke after the previous page edit.
The redirect is from 2010; the health-care provider lookup is new.
Many of our sites are based on defunct template, which I thought may be the issue. We are looking at rebuilding these but for the time being I tried this on a clean template on a clean Web App where we got our first hint. On these sites we get the warning message that says "Warning: Some of your markup was stripped out. Please use the embed command." So we attempted to use the "Embed Code" portion under insert, which gives the same error. Strangely enough, putting one into a Content Editor using the "Edit Source" button and using the "Embed Code" command strip the text out differently. But they are both consistent in how they strip out the code (Edit Source always strips abcdef to def, for example).
This is getting very frustrating as any time we edit one of these pages we have to reinsert this code and save it, sometimes multiple times until it resolves the issue. I'm including our code for the healthcare lookup for reference though there is no reason to believe the code is actually the issue:
<script src="/_layouts/15/jquery/jquery-1.11.1.min.js"></script>
<div>
<table>
<tbody>
<tr>
<td colspan="2">Enter your Zip Code:</td>
</tr>
<tr>
<td style="vertical-align:top;">
<input id="ZipCodeTextBox" type="text"/>
</td>
<td>
<span id="aetna-button">
<input id="GoButton" type="button" value="Go"/></span>
<br/>
<br/><span id="aetna-loader" style="display: none;">
<i>  Please wait...</i></span> </td>
</tr>
</tbody>
</table>
</div>
<div id="resultPane" style="display: none;">
<p>
<b> Below, type your Healthcare Professional's name under the heading "Who or what are you looking for?". </b></p>
<iframe width="100%" height="1000" id="resultFrame"> </iframe> </div>
<script>
$(document).ready(function(){
$("#ZipCodeTextBox").keyup(function (event) {
if (event.keyCode == 13) {
performLookup();
}
});
$('#GoButton').click(function(){
performLookup();
});
});
function performLookup(){
var zip = $('#ZipCodeTextBox').val();
if(zip.length < 1){
alert('Please enter a zip code to continue.');
return;
}
var loader = document.getElementById('aetna-loader');
$('#aetna-button').attr('style','display:none');
$('#aetna-loader').removeAttr('style');
var url = "http://www.someurl.com/?geoSearch=" + zip;
$('#resultFrame').attr('src',url);
setTimeout(revealFrame,3000);
}
function revealFrame(){
$('#aetna-loader').attr('style','display:none');
$('#aetna-button').removeAttr('style');
$('#resultPane').removeAttr('style');
}
</script>
All replies (2)
Tuesday, October 21, 2014 3:02 PM âś…Answered
Hi,
Use Script Editor Web part instead of Content Editor Web part.
Please mark it answered, if your problem resolved or helpful.
Thursday, July 23, 2015 9:38 AM
JavaScript code to is being removed to prevent security problems, such as cross-site scripting, which can compromise your web site. An alternative would be to use embed code on the page, for detailed information please refer to below links: