When you add Yammer embed feed to your Sharepoint Online site you may have the following problem: if user didn’t complete Yammer signup then instead of the feed he or she will see empty box inside iframe. To be more precise you may face with this problem if your site is running on any other platform or technology, but as I faced with it on Sharepoint Online, I decided to mentioned it here.
Let’s see it in more details. Embedded feed is loaded using the following code:
When user has active Yammer profile it shows the Yammer feed in iframe which is added into div with specified identifier. However when user doesn’t have profile yet, empty page will be shown. The reason of this problem is the following: when user didn’t complete Yammer signup and iframe loads feed page which URL looks like this:
(instead of example.com you will have your domain here and bust will have identifier which corresponds to the current user), it redirects user to the following page:
One of the HTTP headers returned in response for this page is the following:
This header tells to the browser that remote site can’t be loaded in iframe if parent page belongs to different domain (different from yammer.com).
In order to tell user about that he or she should complete signup first the following script may be used:
It starts polling the DOM and when iframe is added by yam.connect.embedFeed() call, it reads its src and uses it when add informational notice above the iframe, which looks like this:
The drawback of this approach is that this text will be shown both for users which already completed signup and for users which didn’t do that.