Skip to content
  • Helmut Hummel's avatar
    [BUGFIX] Let save and preview button behave as user initiated · ae1bdc3f
    Helmut Hummel authored
    Browsers started to distinguish how opening a new window
    from JavaScript happens. They track "user initiated"
    opening and not user initiated opening and behave differently.
    
    A request to open a window by JavaScript which is not
    user initiated is caught by a pop up blocker most of the time nowadays.
    This means a user must explicitly allow the current page to
    open new windows by JavaScript.
    
    Additionally some browsers (e.g. Chrome) always open a new window
    instead of a new tab if the request is not user initiated, regardless
    of browser settings, which nowadays default to open a new tab.
    
    The "save and preview" button currently initiates a page reload
    which saves the document and add some JavaScript to to open a preview
    window in the HTML response of this action.
    This JavaScript action is then not considered to be user initiated any more
    as opening the new window does not follow a direct user click action.
    
    The result is, that if a preview window/tab was opened previously, then
    the preview/window tab is just reloaded with the new preview URL.
    If it is the first time the window/tab should be opened this request
    is caught by the popup blocker.
    
    Other preview buttons in the backend (from Click Menu or action toolbar)
    behave differently (correctly) as they are always identified as user initiated.
    
    For that reasons, change the "save and preview" button to directly
    open a new window on click (without URL) and let the HTML/ JavaScript response
    set the correct preview URL after that.
    
    By doing so we gain a consistent behavior no matter what preview button a user
    clicks first.
    The only downside is, that in case the preview window is opened
    the first time, it remains empty until the page is saved and then reloaded
    through the JavaScript code that is already present.
    
    Resolves: #62503
    Releases: 6.2, master
    Change-Id: I7a96c347453b1ccdeaf0d8d1bd5b080f905563ca
    Reviewed-on: http://review.typo3.org/33576
    
    
    Reviewed-by: default avatarStefan Froemken <froemken@gmail.com>
    Tested-by: default avatarStefan Froemken <froemken@gmail.com>
    Reviewed-by: default avatarMarkus Klein <klein.t3@reelworx.at>
    Tested-by: default avatarMarkus Klein <klein.t3@reelworx.at>
    ae1bdc3f