无法获取fullcalendar来显示Google日历中的活动

时间:2012-03-12 21:59:19

标签: fullcalendar

这很奇怪。我只是尝试使用共享的Google日历来建立fullcalendar的基本功能。我试过简单地替换gcal demo" gcal.html"使用我自己的日历网址。日历可以自行打开。这是一些代码:

<head>
<link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' />
<link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.print.css' media='print' />
<script type='text/javascript' src='../jquery/jquery-1.7.1.min.js'></script>
<script type='text/javascript' src='../jquery/jquery-ui-1.8.17.custom.min.js'></script>
<script type='text/javascript' src='../fullcalendar/fullcalendar.min.js'></script>
<script type='text/javascript' src='../fullcalendar/gcal.js'></script>
<script type='text/javascript'>

    $(document).ready(function() {

        $('#calendar').fullCalendar({
        header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,basicWeek,basicDay'
            },
            // US Holidays
            events: 'https://www.google.com/calendar/embed?src=r9k375tdhq8auc1oc4kgmhpri4%40group.calendar.google.com&ctz=America/Chicago',
            eventClick: function(event) {
                // opens events in a popup window
                window.open(event.url, 'gcalevent', 'width=700,height=600');
                return false;
            },

            loading: function(bool) {
                if (bool) {
                    $('#loading').show();
                }else{
                    $('#loading').hide();
                }
            }

        });

    });

</script>

我非常确信我拥有所有依赖关系等等,因为我在gcal演示中。当我将URL插入地址栏时,我的日历会打开。此日历设置为公开。任何帮助,将不胜感激。如果我可以使用谷歌日历,完整日历似乎是一个很好的配对。

1 个答案:

答案 0 :(得分:1)

您没有使用正确的网址。 FullCalendar需要一个XML提要,而不是整个日历,而这正是您所提供的。

See the documentation

请尝试按照以下步骤操作:

  

您必须先公开自己的Google日历:

In the Google Calendar interface, locate the "My Calendar" box on the left.
Click the arrow next to the calendar you need.
A menu will appear. Click "Share this calendar."
Check "Make this calendar public."
Make sure "Share only my free/busy information" is unchecked.
Click "Save."
     

然后,您必须获取日历的XML Feed网址:

In the Google Calendar interface, locate the "My Calendar" box on the left
Click the arrow next to the calendar you need.
A menu will appear. Click "Calendar settings."
In the "Calendar Address" section of the screen, click the XML badge.
Your feed's URL will appear.

我相信这是您想要的网址

https://www.google.com/calendar/feeds/r9k375tdhq8auc1oc4kgmhpri4%40group.calendar.google.com/public/basic