Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work when using privacy plugins #17

Closed
steebchen opened this issue Jul 19, 2018 · 6 comments
Closed

Doesn't work when using privacy plugins #17

steebchen opened this issue Jul 19, 2018 · 6 comments

Comments

@steebchen
Copy link
Contributor

The jsonp request simply times out when you have privacy plugins like Disconnect or Ghostery installed. It also happens when you use the privacy mode in Firefox Quantum. The error does get caught, but jsonp's default timeout is 60s. Do you think we could this set to maybe, let's say, 5 or 10 seconds, using jsonp's timeout option? I don't think there's too much value waiting for a request if it didn't respond after 5 seconds - it will likely not ever return.

@benjaminhoffman
Copy link
Owner

looking into this.

@benjaminhoffman
Copy link
Owner

interesting. we can do that. but the bigger question is, how to make it work with privacy plugins? there's no reason it shouldn't.

anyway, would something like this work?

for this line: https://github.com/benjaminhoffman/gatsby-plugin-mailchimp/blob/master/src/index.js#L14

could be this: return jsonp(url, { param: 'c', timeout: 60000 }, (err, data) => {

thoughts? want to open a PR?

@steebchen
Copy link
Contributor Author

Well your line of code simply wouldn't change anything - jsonp uses 60000 as timeout by default. I'd suggest to lower this value to 5000 or 10000.

What mailchimp does by default is setting the "action" attribute on the form so it simply fallbacks to POSTing to a new tab where you can confirm your subscription. However, I'm not sure how to do this here because we don't know whether the request will fail before we send it.. and we can't open a new window because it will be blocked by popup blockers.

@benjaminhoffman
Copy link
Owner

hmm. so not much in terms of finding a workable solution? i think the next best answer is to leave a comment in the README. any ideas on this one?

@steebchen
Copy link
Contributor Author

No, but as I said I would just use a timeout of around 5 seconds. An error message is better than a 60s timeout where the user bounces because he doesn't know what's happening. The error message could include that adblockers or privacy plugins should be disabled.

@benjaminhoffman
Copy link
Owner

8fffe3a

thx again @steebchen for the issue and suggested fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants