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

Firefox logout problem #3589

Closed
anastis opened this issue Aug 5, 2013 · 2 comments
Closed

Firefox logout problem #3589

anastis opened this issue Aug 5, 2013 · 2 comments

Comments

@anastis
Copy link

anastis commented Aug 5, 2013

There is a case where you get logged out/session cleared/cart emptied, due to a combination of WooCommerce + WordPress + Firefox.

Firefox uses prefetching.
https://developer.mozilla.org/en-US/docs/Link_prefetching_FAQ

WordPress adds <link> elements pointing to previous and next pages, in wp_head().
Rel: wp-includes/default-filters.php:204 add_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );

WooCommerce's logout URL is handled through a page.

Therefore, when viewing a page adjacent to the logout page, WordPress adds the logout url in the header, like <link rel='prev' title='Logout' href='http://www.example.com/logout/' />
Firefox tries to prefetch that page, and since the page is essentially visited, you get logged out.

Possible solutions

  1. Hook on _{$adjacent}post_rel_link filter, check if it's the logout url, and return nothing (or something else) if it is.
  2. Change the way WooCommerce handles logouts.
  3. Add option to unhook adjacent_posts_rel_link_wp_head
  4. Convince WordPress to drop adjacent_posts_rel_link_wp_head completely.
  5. Convince Firefox to drop prefetching completely.

Hope this helps :)

@maxrice
Copy link
Contributor

maxrice commented Aug 5, 2013

What an amusing bug, excellent write up! 👍

@anastis
Copy link
Author

anastis commented Aug 5, 2013

Cheers!
Took me a while to find the root causes.

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