I am trying to prevent a page in SharePoint (specifically a list view page) from automatically generating links from UNC file paths that are entered in a field.
This is entered into the field...
\\server\share\folder name\sub-folder name
This is the automatically generated resultant value of the field...
<a href="http://file\\server\share\folder">\\server\share\folder</a> name\sub-folder name
I have found some similar questions regarding removing mailto links that suggest using jQuery to accomplish this. This is what I came up with thus far...
<script src="http://ift.tt/1mWWrGH"></script>
<script type="text/javascript">
$(function() {
$("a[href^=file:]").each(function(){
var sFileShare = $(this).text();
$(this).replaceWith(sFileShare);
});
});
</script>
I inserted this into the target page by adding a (hidden) CEWP and then putting the above code in as embedded code. Thus far I see no result.
Is this a code issue? Am I implementing it wrong? Should I have stayed asleep this morning? Taking all bets.
My bet is that I need to format the $("a[href^=file:]") bit more correctly but I'm not sure.
Aucun commentaire:
Enregistrer un commentaire