     @$dialog.dialog('open')
 
   onDialogClosing: (event) ->
-    if @implementsIFramePhone and @hasUnsavedState
-      confirm("You have unsaved Labbook content.  Are you sure you want to close?")
-    else
-      true
+    return true if not @implementsIFramePhone or @canClose
+    @phone.post('canClose')
+    return false
 
   onDialogClose: ->
     # Notify LARA that dialog has been closed, so album has been (probably!) updated.

    })

  setIframeUrl: (newUrl) ->
    @hasUnsavedState = false
    @implementsIFramePhone = false

    @startWaiting(t('LOADING_LABBOOK'))
    @$iframe.hide()
    @$iframe.attr('src', newUrl)
    @$iframe.one 'load', =>
      @phone?.disconnect()
      @phone = IframePhoneManager.getPhone(@$iframe[0], => @phoneAnswered())
      @stopWaiting()
      @$iframe.fadeIn()

  phoneAnswered: ->
    @implementsIFramePhone = true
    @phone.addListener 'interactiveState', (state) =>
      @hasUnsavedState = state isnt "nochange"

  startWaiting: (message) ->
    startWaiting(message, WAIT_MSG_SEL) # defined in wait-message.js

    @isUpload = @$element.data('is-upload')

    @implementsIFramePhone = false
    @canClose = false

    unless @isUpload
      intId = @$element.data('interactive-id')
