2

I need to integrate a calendar in various sites ( on different domains ) The calendar will be a wordpress installation with our calendar plugin. All the sites that will show the calendar will share the same database ( so if site A has a "New York" section and site B has a "New York" section the data shown will be the same, while the presentation might vary.
The websites are all created with different tecnologies, some are java, some asp...the obvious idea to integrate the calendar into all those site is using an iframe and pass some configuration parameters in the src. One parameter could be the city and the other could be the site you are visiting ( to adjust the presentation accordingly ). So for example you would have

<iframe src="http://yourcalendar.com/new-york/site-a">

and

<iframe src="http://yourcalendar.com/new-york/site-b">

I was wondering what could be the drawbacks of this approach and if there are other possible approaches. One problem could be that bookmarking an event wouldn't be possible, but i think that you could work around this with some javascript ( i don't know if i can catch the click event from the document that contains the iframe since it's on a different domain but i think that somehow things might work ).

What do you think?

EDIT - Maybe i wasn't clear, i need to use wordpress to diplay the calendar ( even if the site that displays the calendar is in Java ) and the sites are not on a local network.

Nicola Peluchetti
  • 72,169
  • 29
  • 129
  • 186
  • 1
    You could provide an XML feed of the data, so all your sites can use the data in their own systems. You can then also use a cacheing system to reduce the load on your server. – Waygood Aug 22 '12 at 09:38
  • @Waygood no because i need wordpress to handle the presentation. It must be transparent – Nicola Peluchetti Aug 22 '12 at 09:53

2 Answers2

2
  1. If iframes are on same domain as your sites, you can very well do all the javascript talking between the page and the iframe to capture events.

  2. If you want, you can also use ajax to fetch HTML/Script content of your calender to your page, and write it into a container like div . This can work if your calender content is on same domain as that of your website.

  3. If your calender content needs to be fetched from other domain whose content is in your control, then you can use jsonp format for cross domain content fetching.

DhruvPathak
  • 38,316
  • 14
  • 103
  • 164
  • 1
    All the sites are on different domains, but i have control an all the sites, so jsonp could be an option, i simply need to return the html for my calendar and display it in a div. What are the possible drawbacks of jsonp? – Nicola Peluchetti Aug 22 '12 at 09:57
  • @NicolaPeluchetti Well, it could work very well for your case, you will need to overview possible security risks though. I would also recommend you to have a look at : http://stackoverflow.com/questions/153152/resizing-an-iframe-based-on-content for a possible cross domain iframe communication when you have access to content on both domains. – DhruvPathak Aug 22 '12 at 10:53
-1

I would personally go with JavaScript or a PHP include file if your page is dynamic

IFRAMES can be disallowed or filtered by browser addons or security settings, while JavaScript practically never is

Zathrus Writer
  • 4,209
  • 4
  • 24
  • 48
  • One site is in asp, one site is in Java, i need to display the content generated by wordpress in those sites – Nicola Peluchetti Aug 22 '12 at 09:51
  • so those 2 sites are located at a different domain? – Zathrus Writer Aug 22 '12 at 09:53
  • Yes they are on different domains and written in different tecnologies – Nicola Peluchetti Aug 22 '12 at 09:54
  • then, if you can edit those 2 pages, [JSONP](http://api.jquery.com/jQuery.getJSON/) would be your best bet in terms of JavaScript - it's the only way to make cross-site requests other than using an IFRAME of some hack-ish FLASH and proxy relays – Zathrus Writer Aug 22 '12 at 09:55
  • …JavaScript can be disallowed or filtered by browsers, while IFRAMES practically never are disabled… – feeela Aug 22 '12 at 10:07
  • @feeela would you mind backing up your comment by some data before downvoting my answer at least? from my experience, the only browser with JavaScript disabled is an outdated search engine nowadays, though many companies have internal security policies in Internet Explorer disallowing insecure elements on page (IFRAMES included) or people tend to use AdBlock to remove IFRAMES from pages completely – Zathrus Writer Aug 22 '12 at 10:10
  • And from my experience, most developers in my company have JavaScript disabled or filtered when browsing the web. But that was not the reason for downvoting. The question was about the pros and cons about using iframes; not about guessing around based on some disputable experiences. – feeela Aug 22 '12 at 10:14
  • @feeela thanks for your explanation, the question really was about pros and cons using IFRAMEs, so I provided my knowledge... with regards to developers having JS turned off - it's developers, they are expected to have them disabled, but also they won't be able to use Facebook without it either, which is what a normal user would like to do :) – Zathrus Writer Aug 22 '12 at 10:21