zoukankan      html  css  js  c++  java
  • Using Javascript to display RSS

    Using Javascript to display RSS

    I have written about using Javascript to display RSS previously. It seems people are still interested in the subject so I thought I would revisit the subject.

    Javascript and RSS

    First of I need to let you know that Javascript and RSS cannot be used exclusively to display a feed on your site. The reason for this is that the RSS feed needs to be parsed which involves extracting the data from the feed.

    This means that a third language needs to be used such as PHP which requires a server to run the code. Javascript on the other hand is processed by your web browser. For this reason Javascript as a tool for displaying an RSS feed is considered a poor substitute for server side RSS processing using a language such as PHP

    Javascript if you insist

    On the plus side Javascript options for displaying RSS on your site are a quick and simple option. The reason for this is because someone else has done the hard work already.

    First of all you will need to find a service that has done this hard work, here are sites that offer RSS to Javascript processing.

    The process is pretty simple, just let them know the RSS feed and the display options. You will then need to copy some Javascript that you will need to paste into your site and there you have your feed.

    Benefits and cost

    Whilst displaying an RSS feed on your site will provide you with some content and therefore some stickiness there are some downsides. You will be dependant on the service you have chosen being around, there will be downtime and the site may disappear altogether. You will not get and Search engine benefits as they cannot yet crawl Javascript.

    Alternative to Javascript

    If you prefer a more flexible and beneficial alternative the you could use PHP to parse and display your RSS feed. You will need some PHP knowledge for this but it is worth the effort.

    SimplePie offers a free PHP class that does most of the hard work for you making it relatively easy to use your own web server to display RSS feeds. There are other more established alternatives such as Magpie and Carp but SimplePie offers good documentation and clear instructions.

    Source from :http://www.newsniche.com/using-javascript-to-display-rss.php

  • 相关阅读:
    043_生成随机密码
    042_提示用户输入年份后测试判断是否为闰年
    041_查找 Linux 系统中的僵尸进程
    040_删除某个目录下大小为 0 的文件
    039_显示 CPU 厂商信息
    038_使用脚本自动创建逻辑卷
    037_自动添加防火墙规则,开启某些服务或端口(适用于 RHEL7)
    bzoj1537
    bzoj2466
    bzoj1047
  • 原文地址:https://www.cnblogs.com/likehua/p/1965271.html
Copyright © 2011-2022 走看看