Sunday, 11 August 2013

Why does opening a websocket in Safari 5.x thru 6.x invalidate the back cache?

Why does opening a websocket in Safari 5.x thru 6.x invalidate the back
cache?

pIf I open a page in Safari for example/p precodehttp://stackoverflow.com
/code/pre pthen open the safari console and open a websocket, for
example:/p precodevar ws = new WebSocket(ws:ws.dslreports.com) /code/pre
pthen I click a link on the page, and then press BACK the back cache is
now ignored and the page is reloaded. I observe this on Safari 5.0 (which
first introduced hixie websocket support) and latest Safari 6.x which uses
hybi. Chrome and Firefox and other browsers supporting websockets do not
seem to invalidate the back cache in this way./p pAs a result I can't
enable websockets in Safari, because doing so invalidates the back cache
for the first BACK to any page that created a connection. Subsequent BACKs
work, however, unless the page makes an effort to reconnect, if so, EVERY
page causes a back-cache miss./p pIs this by design? any work around other
than fall back to polling for Safari users. This would be a shame as
Safari otherwise supports websockets just fine./p pupdate: the unexpected
invalidation behaviour does not happen with mobile Safari eg on IOS, a
page can use a websocket and going to a new link and pressing back does
not re-request the page from the server./p

No comments:

Post a Comment