<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Timeout in ArcGIS Viewer for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/timeout/m-p/467240#M13279</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Phillip,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; This is what I found on the subject that is closest to what you are looking for.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.webmasterworld.com/javascript/4332132.htm"&gt;http://www.webmasterworld.com/javascript/4332132.htm&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Jan 2012 14:32:29 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2012-01-30T14:32:29Z</dc:date>
    <item>
      <title>Timeout</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/timeout/m-p/467239#M13278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am using a simple login scenario which is built in to the index.html file.&amp;nbsp; When this page is accessed it uses a state to show the login screen, then when the user passes the authentication the state switches to the viewer.&amp;nbsp; Is there a way I can make the web app timeout after a period of inactivity - which would cause the page to refresh and automatically then force the user to log back in to the site?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried using IIS to set timeout connections but those settings only pertain to asp.net as far as I can see and they do not affect the flexviewer app.&amp;nbsp; Is there some html code I can include in the index.html to make this happen?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2012 13:23:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/timeout/m-p/467239#M13278</guid>
      <dc:creator>philippschnetzer</dc:creator>
      <dc:date>2012-01-30T13:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Timeout</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/timeout/m-p/467240#M13279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Phillip,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; This is what I found on the subject that is closest to what you are looking for.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.webmasterworld.com/javascript/4332132.htm"&gt;http://www.webmasterworld.com/javascript/4332132.htm&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2012 14:32:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/timeout/m-p/467240#M13279</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2012-01-30T14:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: Timeout</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/timeout/m-p/467241#M13280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I couldn't make the code from the above link work for me....but I did find something else:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;lt;script type="text/javascript"&amp;gt;
var xScroll, yScroll, timerPoll, timerRedirect;

function initRedirect(){
&amp;nbsp; if (typeof document.body.scrollTop != "undefined"){ //IE,NS7,Moz
&amp;nbsp;&amp;nbsp;&amp;nbsp; xScroll = document.body.scrollLeft;
&amp;nbsp;&amp;nbsp;&amp;nbsp; yScroll = document.body.scrollTop;

&amp;nbsp;&amp;nbsp;&amp;nbsp; clearInterval(timerPoll); //stop polling scroll move
&amp;nbsp;&amp;nbsp;&amp;nbsp; clearInterval(timerRedirect); //stop timed redirect

&amp;nbsp;&amp;nbsp;&amp;nbsp; timerPoll = setInterval("pollActivity()",1); //poll scrolling
&amp;nbsp;&amp;nbsp;&amp;nbsp; timerRedirect = setInterval("location.href='www.google.com'",1200000); //set timed redirect

 
&amp;nbsp; }
&amp;nbsp; else if (typeof window.pageYOffset != "undefined"){ //other browsers that support pageYOffset/pageXOffset instead
&amp;nbsp;&amp;nbsp;&amp;nbsp; xScroll = window.pageXOffset;
&amp;nbsp;&amp;nbsp;&amp;nbsp; yScroll = window.pageYOffset;

&amp;nbsp;&amp;nbsp;&amp;nbsp; clearInterval(timerPoll); //stop polling scroll move
&amp;nbsp;&amp;nbsp;&amp;nbsp; clearInterval(timerRedirect); //stop timed redirect

&amp;nbsp;&amp;nbsp;&amp;nbsp; timerPoll = setInterval("pollActivity()",1); //poll scrolling
&amp;nbsp;&amp;nbsp;&amp;nbsp; timerRedirect = setInterval("location.href='www.google.com'",1200000); //set timed redirect

&amp;nbsp; 
&amp;nbsp; }
&amp;nbsp; //else do nothing
}

function pollActivity(){
&amp;nbsp; if ((typeof document.body.scrollTop != "undefined" &amp;amp;&amp;amp; (xScroll!=document.body.scrollLeft || yScroll!=document.body.scrollTop)) //IE/NS7/Moz
&amp;nbsp;&amp;nbsp; ||
&amp;nbsp;&amp;nbsp; (typeof window.pageYOffset != "undefined" &amp;amp;&amp;amp; (xScroll!=window.pageXOffset || yScroll!=window.pageYOffset))) { //other browsers
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; initRedirect(); //reset polling scroll position
&amp;nbsp; }
}

document.onmousemove=initRedirect;
document.onclick=initRedirect;
document.onkeydown=initRedirect;
window.onload=initRedirect;
window.onresize=initRedirect;

&amp;lt;/script&amp;gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There are still some bugs...it doesn't seem to actually honour mouseevents...but you can easily set the time delay before a redirect occurs (so I just tell it to redirect to the index.html file which requires the user to log back in).&amp;nbsp; Could be much better (ie, little dialog window could appear telling the user the app is about to timeout...) but it will do for now...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:44:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/timeout/m-p/467241#M13280</guid>
      <dc:creator>philippschnetzer</dc:creator>
      <dc:date>2021-12-11T20:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: Timeout</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/timeout/m-p/467242#M13281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Found the solution.&amp;nbsp; Scrap the above code I posted because it doesn't actually capture whether the user is active or not.&amp;nbsp; Decided to make it happen directly in flex.&amp;nbsp; So, here goes....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In ViewContainer.mxml add these import statements:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import mx.managers.SystemManager; &amp;nbsp;&amp;nbsp; import mx.events.FlexEvent; &amp;nbsp;&amp;nbsp; import mx.core.mx_internal; &amp;nbsp;&amp;nbsp; use namespace mx_internal;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then inside the creationCompleteHandler function add:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;systemManager.addEventListener(FlexEvent.IDLE, userIdle);&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and add this new function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;private function userIdle(e:FlexEvent):void { &amp;nbsp;&amp;nbsp;&amp;nbsp; if(e.currentTarget.mx_internal::idleCounter == 9000){ // 15 mins Elapsed while Being Idle!! &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // do something when the application has been idle for 15 mins &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; navigateToURL(new URLRequest('http://www.this url works for me because it redirects the user to the login page/index.html'), '_self'); &amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;credit goes to this &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://flexr.wordpress.com/2009/06/10/user-idle-time-no-mouse-movement-no-keyboard-stockes-in-flex/" rel="nofollow" target="_blank"&gt;website&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, the above code works well if you have a login required for the app, if not then you might need to tweak the code to do something other than a simple redirect to the main login page...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2012 17:48:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/timeout/m-p/467242#M13281</guid>
      <dc:creator>philippschnetzer</dc:creator>
      <dc:date>2012-02-08T17:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: Timeout</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/timeout/m-p/467243#M13282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Phillip,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Great find. Make sure you make your post as the answer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2012 18:19:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/timeout/m-p/467243#M13282</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2012-02-08T18:19:42Z</dc:date>
    </item>
  </channel>
</rss>

