How to open Apple's native calendar app and add a new calendar entry from a HTML asset?

Modified on Tue, 9 Oct, 2018 at 9:07 AM


The code to open the native iOS calendar is as below. Update the index.html with the dates and times of the calendar entry:


<span img id="add" src="images/add.png" class="addtocalendar atc-style-blue">
              <var class="atc_event">
                <var class="atc_date_start">2017-02-18 00:00:00</var>
                <var class="atc_date_end">2017-02-18 24:00:00</var>
                <var class="atc_timezone">Australia/Sydney</var>
                <var class="atc_title">ADS Practical Skills Course</var>
                <var class="atc_description">Practical Skills Course for Endocrinology &amp;amp;amp;amp;amp; General Medicine Advanced Trainees</var> <var class="atc_location">Melbourne Marriott Hotel Victoria</var> <var class="atc_organizer">CompanyName</var>
              </var>
            </span>

// Copyright (c) 2018 The Interact Technology Group.
// THE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// All rights reserved.


Open the index.html file in a browser and click on the Add to Calendar. Right click on the iCalendar and copy the link.

The link copied will be long, open a web browser and go to goo.gl to shorten the URL. Paste in the URL the click Shorten URL


Copy the shortened link and then click Done


Open the file named main.js and paste in the shortened URL(in the highlighted area, ensuring you stop before the "?"). Update both lines containing "window.location" with the shortened URL.

}(), $(document).ready(function() {
    $("#add").click(function() {
        var t = /(iPad|iPhone|iPod)/g.test(navigator.userAgent),
            o = /(android)/i.test(navigator.userAgent);
        t && setTimeout(function() {
            window.location = "https://goo.gl/BeKDys?nibrowser=no"
        }, 100), o && setTimeout(function() {
            window.location = "https://goo.gl/SRggH7?nidownload"
        }, 100)
    })
});

// Copyright (c) 2017 The Interact Technology Group.
// THE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// All rights reserved.











Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article