<!-- 
RSS generated by JIRA (9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b) at Sun Feb 11 23:06:44 CET 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Magnolia - Issue tracker</title>
    <link>https://jira.magnolia-cms.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-uk</language>    <build-info>
        <version>9.4.2</version>
        <build-number>940002</build-number>
        <build-date>19-01-2023</build-date>
    </build-info>


<item>
            <title>[ADMINCTR-395] Exporting / downloading magnolia app content triggers &quot;unload&quot;-Event of page window</title>
                <link>https://jira.magnolia-cms.com/browse/ADMINCTR-395</link>
                <project id="17484" key="ADMINCTR">Admincentral</project>
                    <description>&lt;h2&gt;&lt;a name=&quot;Stepstoreproduce&quot;&gt;&lt;/a&gt;Steps to reproduce&lt;/h2&gt;
&lt;ol&gt;
	&lt;li&gt;register java script function for page window event &quot;unload&quot;&lt;/li&gt;
	&lt;li&gt;download some content from admincentral (asset, translations, yaml/xml from jcr browser...)&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;.. &lt;font color=&quot;#c1c7d0&quot;&gt;&lt;em&gt;Logs, screenshots, gifs...&lt;/em&gt;&lt;/font&gt;&lt;/p&gt;
&lt;h3&gt;&lt;a name=&quot;Expectedresults&quot;&gt;&lt;/a&gt;Expected results&lt;/h3&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;em&gt;the java-script function registered for the unload event is NOT called&lt;/em&gt;&lt;/li&gt;
	&lt;li&gt;&lt;em&gt;downloading some content (file) should not trigger the same java-script page events as closing the browser tab&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;&lt;a name=&quot;Actualresults&quot;&gt;&lt;/a&gt;Actual results&lt;/h3&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;em&gt;the java-script function registered for the unload event IS called&lt;/em&gt;&lt;/li&gt;
	&lt;li&gt;&lt;em&gt;Within the java-script function I cannot distinguish between a download and closing the browser tab&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;&lt;a name=&quot;Workaround&quot;&gt;&lt;/a&gt;Workaround&lt;/h3&gt;
&lt;ul&gt;
	&lt;li&gt;setting a marker session attribute when executing an export command and do not execute &quot;unload&quot;-function if present&lt;/li&gt;
	&lt;li&gt;not a got idea because this meeas to overwrite several commands in several modules&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;&lt;a name=&quot;Developmentnotes&quot;&gt;&lt;/a&gt;Development notes&lt;/h3&gt;

&lt;p&gt;For our use case (invalidate magnolia session when closing the browser or it&apos;s tab) this has the effect that the user get&apos;s logged out when exporting some content.&lt;/p&gt;

&lt;p&gt;Any suggestions for an alternative implementation?&lt;/p&gt;</description>
                <environment>Custom code: &lt;br/&gt;
Implemented security improvement - close magnolia admincentral session when user closes browser tab.&lt;br/&gt;
- add java script function &amp;quot;uiUnload&amp;quot; to current UI page: invalidate magnolia session&lt;br/&gt;
- register uiUnload function for events &amp;quot;beforeunload&amp;quot; and &amp;quot;unload&amp;quot; at UI page javaScript&lt;br/&gt;
-- UI.getCurrent().getPage().getJavaScript().execute(&amp;quot;window.addEventListener(&amp;#39;unload&amp;#39;, &amp;quot; + FN_UI_UNLOADED + &amp;quot;);&amp;quot;);</environment>
        <key id="133618">ADMINCTR-395</key>
            <summary>Exporting / downloading magnolia app content triggers &quot;unload&quot;-Event of page window</summary>
                <type id="1" iconUrl="https://jira.magnolia-cms.com/secure/viewavatar?size=xsmall&amp;avatarId=10883&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.magnolia-cms.com/images/icons/priorities/major.svg">Major</priority>
                        <status id="1" iconUrl="https://jira.magnolia-cms.com/images/icons/statuses/open.png" description="The issue is open and ready for the assignee to start work on it.">Open</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="wolfbubenik">Wolf Bubenik</reporter>
                        <labels>
                    </labels>
                <created>Wed, 31 May 2023 15:58:30 +0200</created>
                <updated>Wed, 21 Jun 2023 14:28:22 +0200</updated>
                                            <version>6.2.27</version>
                                                        <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="359492" author="rkovarik" created="Thu, 1 Jun 2023 07:30:42 +0200"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.magnolia-cms.com/secure/ViewProfile.jspa?name=wolf.bubenik&quot; class=&quot;user-hover&quot; rel=&quot;wolf.bubenik&quot;&gt;wolf.bubenik&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Looks like this is a browser behaviour as described here:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;The most common case is if the user clicks a link that starts a download. In that case the browser will fire the event immediately when the user clicks the link. Slightly later when the browser receives the response headers, it will discover that it&apos;s a download and not a new HTML page to display. The end result is then that&#160;&lt;tt&gt;beforeunload&lt;/tt&gt; has been fired but the previous page is still kept running.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/56651887/vaadin-onbeforeunload-event&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://stackoverflow.com/questions/56651887/vaadin-onbeforeunload-event&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are some pointers how to workaround this from Leif from Vaadin.&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Hope that helps&lt;/p&gt;

&lt;p&gt;Roman&lt;/p&gt;</comment>
                            <comment id="359531" author="wolf.bubenik" created="Thu, 1 Jun 2023 10:49:17 +0200"  >&lt;p&gt;Thanks a lot, @Roman. This helps understanding what is going on. As I see it, there is not much (nothing) you can do about it.&lt;/p&gt;

&lt;p&gt;What I want to achieve is to invalidate the magnolia session when the user closes the browser tab without logging out. Unluckily at least some browsers (Firefox) only trigger &quot;&lt;font color=&quot;#067d17&quot;&gt;&lt;font color=&quot;#172b4d&quot;&gt;&lt;/font&gt;beforeunload&quot; in this situation, but not &quot;unload&quot;. &lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;&quot;&gt;&lt;/font&gt;&lt;/p&gt;</comment>
                            <comment id="359609" author="wolf.bubenik" created="Thu, 1 Jun 2023 15:11:19 +0200"  >&lt;p&gt;Hi Roman, I googled a bit and found that it is a general problem to trigger some action like logout when closing the browser tab or browser.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;I have to react on the &quot;beforeunload&quot; event&lt;/li&gt;
	&lt;li&gt;This event is fired whenever I leave the page: navigation, page reload, closing tab... and downloading something...&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;The most promising solution I found (the one I understand &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.magnolia-cms.com/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; ) is to bind a function to all events we want to ignoere (click link, press F5...) and set a flag that this is a valid action:&lt;/p&gt;

&lt;p&gt;See:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/questions/3888902/detect-browser-or-tab-closing&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://stackoverflow.com/questions/3888902/detect-browser-or-tab-closing&lt;/a&gt;&#160;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/questions/20853142/trying-to-detect-browser-close-event/26275621#26275621&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://stackoverflow.com/questions/20853142/trying-to-detect-browser-close-event/26275621#26275621&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
$(document).ready(function(){         

        &lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; validNavigation = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;

        &lt;span class=&quot;code-comment&quot;&gt;// Attach the event keypress to exclude the F5 refresh (includes normal refresh)
&lt;/span&gt;        $(document).bind(&lt;span class=&quot;code-quote&quot;&gt;&apos;keypress&apos;&lt;/span&gt;, function(e) {
            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (e.keyCode == 116){
                validNavigation = &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;;
            }
        });

        &lt;span class=&quot;code-comment&quot;&gt;// Attach the event click &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; all links in the page
&lt;/span&gt;        $(&lt;span class=&quot;code-quote&quot;&gt;&quot;a&quot;&lt;/span&gt;).bind(&lt;span class=&quot;code-quote&quot;&gt;&quot;click&quot;&lt;/span&gt;, function() {
            validNavigation = &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;;
        });

        &lt;span class=&quot;code-comment&quot;&gt;// Attach the event submit &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; all forms in the page
&lt;/span&gt;        $(&lt;span class=&quot;code-quote&quot;&gt;&quot;form&quot;&lt;/span&gt;).bind(&lt;span class=&quot;code-quote&quot;&gt;&quot;submit&quot;&lt;/span&gt;, function() {
          validNavigation = &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;;
        });

        &lt;span class=&quot;code-comment&quot;&gt;// Attach the event click &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; all inputs in the page
&lt;/span&gt;        $(&lt;span class=&quot;code-quote&quot;&gt;&quot;input[type=submit]&quot;&lt;/span&gt;).bind(&lt;span class=&quot;code-quote&quot;&gt;&quot;click&quot;&lt;/span&gt;, function() {
          validNavigation = &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;;
        }); 

        window.onbeforeunload = function() {                
            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!validNavigation) {     
                &lt;span class=&quot;code-comment&quot;&gt;// -------&amp;gt;  code comes here
&lt;/span&gt;            }
        };

  }); &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Than we check this flag before doing the logout.&lt;/p&gt;

&lt;p&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.magnolia-cms.com/images/icons/emoticons/help_16.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; How to do this with magnolia?&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>relation</name>
                                                                <inwardlinks description="is related to">
                                                        </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                            <customfield id="customfield_14166" key="com.okapya.jira.checklist:checklist">
                        <customfieldname>Acceptance criteria</customfieldname>
                        <customfieldvalues>
                            
        <checklist>
        <![CDATA[
                            




                
                                    <div class="o-completion" style="display: flex; flex-shrink: 0;"><span  class="aui-lozenge aui-lozenge-complete" style="font-size: 12px; font-weight: normal; display: flex; flex-direction: row; align-items: center;" ><span style="padding-right: 4px; vertical-align: middle;"><svg width="15" height="15" viewBox="0 0 15 15" xmlns="http://www.w3.org/2000/svg" fill="white"><path clip-rule="evenodd" d="m10.41037,3.42544l-7.86501,0c-0.72395,0 -1.31084,0.58688 -1.31084,1.31084l0,7.86508c0,0.7239 0.58689,1.3108 1.31084,1.3108l7.86501,0c0.724,0 1.3109,-0.5869 1.3109,-1.3108l0,-7.86508c0,-0.72396 -0.5869,-1.31084 -1.3109,-1.31084zm-7.86501,-0.65542c-1.08593,0 -1.96626,0.88032 -1.96626,1.96626l0,7.86508c0,1.0859 0.88033,1.9662 1.96626,1.9662l7.86501,0c1.086,0 1.9663,-0.8803 1.9663,-1.9662l0,-7.86508c0,-1.08594 -0.8803,-1.96626 -1.9663,-1.96626l-7.86501,0z" fill-rule="evenodd"/><path d="m5.09049,10.18526l-1.82767,-1.82766l-0.78479,0.78479l2.61246,2.61246l5.38758,-5.38754l-0.78483,-0.78479l-4.60275,4.60274z"/></svg></span><span>Empty</span></span></div>
                        ]]>
    </checklist>


                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10111" key="com.atlassian.jira.toolkit:reporterdomain">
                        <customfieldname>Company</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>aperto.de</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10031" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of First Response</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 1 Jun 2023 07:30:42 +0200</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_12730" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_14151" key="com.atlassian.jira.toolkit:message">
                        <customfieldname>Docu info</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10246" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PDI-100</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10061" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comm is not jira-dev</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10071" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last participant</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>ldelnevo</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_13136" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            36 weeks, 3 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10020" key="com.atlassian.jira.toolkit:attachments">
                        <customfieldname>Number of attachments</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10150" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname>Number of comments</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>rkovarik</customfieldvalue>
            <customfieldvalue>wolf.bubenik</customfieldvalue>
            <customfieldvalue>wolfbubenik</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10833" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|y0a2gy:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10244" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_12430" key="com.atlassian.teams:rm-teams-custom-field-team">
                        <customfieldname>Team</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[25]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_14145" key="com.intenso.jira.issue-templates:issue-templates-customfield">
                        <customfieldname>Template</customfieldname>
                        <customfieldvalues>
                            

    <customfieldvalue>Bug template</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_15131" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Time in Discovery</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_13933" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Urgency (resolution)</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="15724"><![CDATA[Normal]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10003" key="com.atlassian.jira.plugin.system.customfieldtypes:multiuserpicker">
                        <customfieldname>Visible to</customfieldname>
                        <customfieldvalues>
                                    <customfieldvalue><![CDATA[jfrantzius]]></customfieldvalue>
        <customfieldvalue><![CDATA[wolfbubenik]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>