Jump to content
Search Community

Synchronous or single-thread tweening?

UncommonDave test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I'm trying to open a new browser window via window.open() after a user has clicked on a button and the button performs an animation first, but I can't simply execute the window.open() in the tweens' callback because the browser no longer believes the call was initiated by a user action... and so it blocks the window as a popup.

 

I've was working on a fix by creating a pop-under and then focus it from the tween callback, but this doesn't feel clean OR stable. I was thinking/hoping there was some sort of option I might be able to pass to the tween that would somehow maintain the integrity of the main thread and allow me to simply open the new window from the callback.

 

Or if somebody had figured out a cleaner workaround than the pop-under method.

Link to comment
Share on other sites

Oooh, that sounds messy. A very strong case could be made that the browser's current behavior is absolutely appropriate. Imagine if browsers let developers spawn new windows whenever they wanted - it could get REALLY bad. Ha. 

 

Mind me asking why you need another window open? Can you do something in an overlay instead? 

 

The pop-under may be your only viable option here. Wish I had a better answer for you. Maybe someone else around here has a better option.

Link to comment
Share on other sites

I definitely understand why browser authors are trying to prevent code-generated windows from popping up willy-nilly (not that spammers and other various ****-heads haven't found workarounds).

 

The use-case here is to access the oAuth pages of some 3rd party apps, and a few of them have set their X-FRAME-OPTIONS to block iframing. The simple solution is to just forego the button animation, and there is no more problem. But I like animating stuff and I wanted my button-click to look cool... so... ya know.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...