Check if cross-origin iframe is loaded with correct status code

时间:2017-04-06 17:06:22

标签: javascript html iframe cross-domain

I'm trying to embed Google Calendar iframe using shared link that works for everyone with google account in our domain.

 <div class="embed-responsive embed-responsive-16by9">
     <iframe class="embed-responsive-item" src="https://calendar.google.com/calendar/b/1/embed?src=..."></iframe>
 </div>

If a user is logged in one of Google accounts in this domain calendar displays properly. Otherwise, the iframe is empty (status code 302). In such case, I need to display some placeholder and message to notify a user.

Javascript access to the loaded content is blocked by the same-origin policy.

How can I check if iframe content is loaded? Thank you in advance.

0 个答案:

没有答案