0

I have an facebook canvas app that loads in an iframe on facebook, and I want to be able to focus the facebook tab in the browser from my code.

My app shows native browser notifications through the browser's Notification API (not facebook notifications), and I would like to focus the Facebook tab (within which my app loaded) when the user clicks the browser notification that my app shows.

If my app is loaded outside of facebook in a tab by itself (not in an iframe), then I can just use window.focus() to refocus the tab; hoever, when loaded in facebook, because of the iframe, window.focus() doesn't focus the tab, and because of cross-site origin, I don't think I can access the parent facebook window context to give it focus.

What solutions or workarounds might there be? I didn't find any functionality exposed by facebook api (eg. something like FB.Canvas.focus())

miir
  • 1,814
  • 1
  • 17
  • 25
  • I wonder if theres a place to request new FB.Canvas API? – miir Jun 13 '17 at 20:01
  • 1
    I am pretty sure even if you requested it, they would not implement such a thing. We all know that a lot of devs simply know no restraints or common sense, so that would just end up a big focus-stealing fight by attention-wh*ring devs, taking place in the user’s browser. – CBroe Jun 14 '17 at 07:45
  • @CBroe My thoughts exactly, would have to be a proper implementation on their side with checks and balances -- some kinds of limitations against abuse. Maybe even some wrapper around native browser notifications. We'll see. – miir Jun 14 '17 at 12:44

0 Answers0