RSS Feeds in SharePoint 2010 using javascript
Copy below tag and paste in SharePoint site:
<div style="color: black; font-family:Trebuchet MS,Helvetica,sans-serif;font-size: 13px; font-weight: bold;">
<a href="#" id="rssLink1" ><img style="border:0" alt="RSS" src="/images/RSS.png" /> RSS feed </a>
</div>
<a href="#" id="rssLink1" ><img style="border:0" alt="RSS" src="/images/RSS.png" /> RSS feed </a>
</div>
Copy below script and paste before </body> in SharePoint site:
<script type="text/javascript">
var links = document.getElementsByTagName('link');
for (i = 0; i < links.length; i++) {
if (links[i].rel == "alternate" && "application/rss+xml" == links[i].type) {
// var t1 = unescape(links[i].href);
// alert(unescape(links[i].href));
try {
// var query = unescape(links[i].href).substring(unescape(links[i].href).indexOf('?') + 1);
document.getElementById('rssLink1').href = unescape(links[i].href);
}
catch (e)
{ }
}
}
</script>
var links = document.getElementsByTagName('link');
for (i = 0; i < links.length; i++) {
if (links[i].rel == "alternate" && "application/rss+xml" == links[i].type) {
// var t1 = unescape(links[i].href);
// alert(unescape(links[i].href));
try {
// var query = unescape(links[i].href).substring(unescape(links[i].href).indexOf('?') + 1);
document.getElementById('rssLink1').href = unescape(links[i].href);
}
catch (e)
{ }
}
}
</script>
No comments: