Opened 14 years ago

Closed 9 years ago

#6897 closed defect (wontfix)

backbutton with iframes breaks cometd connection

Reported by: gregwilkins Owned by: Greg Wilkins
Priority: high Milestone: future
Component: DojoX Cometd Version: 1.1.1
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by dylan)

If a page with a cometd connection established also contains an iframe, and if the back button is click that only changes the content of the iframe, then safari drops the cometd connection.

Specifically the long poll request is terminate SILENTLY! there is no error callback and no timeout callback! cometd still thinks it is connected and can send messages OK, but it cannot receive them.

Note that iframes are used for backbutton handling, so this probably means that backbutton handling cannot be used on safari with cometd.

This is shouting BROWSER BUG! But given the timelag to getting this acknowledged and fixed, a work around would be really good to have????

Attached in an index.html file that can be used with the standard chat demo to show this problem:

1 initiate a chat session 2 click some links in the iframe 3 click the back button 4 see that the chat room stops receiving messages and that no

error handling is triggered.

Attachments (1)

index2.html (844 bytes) - added by gregwilkins 14 years ago.
index for cometd chat demo

Download all attachments as: .zip

Change History (6)

Changed 14 years ago by gregwilkins

Attachment: index2.html added

index for cometd chat demo

comment:1 Changed 14 years ago by dylan

Description: modified (diff)
Milestone: future

comment:2 Changed 12 years ago by jeffContext

I found a workaround that seems to be working so far.

This is an old issue, but I couldn't find another ticket showing progress. Please let me know if I'm overlooking something.

Before each comet message is sent, I have it check window.history.length. If that is ever lower than the value of the last time it was checked, it assumes the user clicked the back button and goes into 'back-button' mode:

  • start batching messages. (cometd.startBatch)
  • abort the current cometd transport and force it to reconnect
  • listen on /meta/connect. After a successful connect (while in back-button mode), end the batch to send the message queue and set the state back to normal.

I had to hack org.cometd.Cometd to force the reconnect without losing messages in the send queue:

   this.forceReconnect = function() {
      if (_transport) {
      _transport = _newTransport('callback-polling');  // TODO: last-used transport type

Please let me know if there is a better way to do it. Also, would be nice if forceReconnect could be added to the main cometd.js dist so I don't have to maintain my own version.

comment:3 Changed 11 years ago by Chris Mitchell

Owner: anonymous deleted

comment:4 Changed 10 years ago by bill

Component: GeneralDojoX Cometd
Owner: set to Greg Wilkins

comment:5 Changed 9 years ago by bill

Resolution: wontfix
Status: newclosed

The CometD library has been removed from DojoX. The CometD project now maintains its own Dojo library in AMD format as part of their project. This will be available via cpm, or may be downloaded from GitHub?. See:

Note: See TracTickets for help on using tickets.