0

I am building a site that requires registration and login.

Once you register, cookies are written to your browser to validate your session. During login, the exact same cookies are written to your browser. I am using the exact same functions and technique for writing cookies in both registration and login.

Here's the problem:

On mobile (at least with Safari for iOS), cookies DO NOT get written during the registration processes, however it works just fine during login. (In a desktop browser, both work fine).

You should know:

The mobile site does not redirect to a different URL, nor does it load any different javascript. It simply uses a media query (CSS) to alter the CSS.

Here's the troubleshooting I've tried:

Verified my "set_cookie" function works on mobile. Set my "block cookies" setting to "never". Verified that the set_cookie function is being called by logging document.cookie each time the function is called (Old/logged out cookies are logged to console, but the new ones simply aren't written). Tested on Safari for iPad, works like a charm.

Things that may be relevant:

The part that isn't working on Safari for iPhone is trying to create cookies from the site root, /, however, the login page (where it DOES work on iPhone) is at /login.html. Both are the same domain. Also, I have verified that the server is successfully creating new users and returning a success response. These requests are being made via AJAX and a JSON object is returned to javascript.

TL;DR:

Cookies won't write from one particular page on Safari for iPhone. This operation works successfully everywhere else. Same set_cookie function being used accross the board and works correctly on other pages on Safari for iPhone. Mobile version is on same domain, does not alter javascript and only changes CSS.

Any thoughts? Thanks!

4

1 回答 1

0

发现解决此问题的方法是进行一些内部/服务器端重组。目前尚不清楚仅在 iPhone 上导致问题的原因,但是,我能够绕过它。如果其他人遇到这个问题,我会感到惊讶。

于 2013-10-01T00:13:55.627 回答