title: how to prevent to stop p:poll after navigating to another page in browser
body: <p>I have a <code>p:poll</code> in my page. When the page is loaded in browser poll should be stat after click on begin button to show run a counter. My problem starts when the user navigate to another page, by click on 'Go to page One'. Because poll time tick is stopped after navigating. when you come back you should click again on begin button to restart counter. Please help me, how to prevent to stop the poll after navigating to another page. I want <code>p:poll</code> continue under any circumstances. I am using primefaces and Apache myfaces 2-2-10. This is a sample that have to page. In page one there are two button. after clicking on Begin button counter starts to show numbers. and button 'Go to Page One' change the page to one.xhtml. in page one after clicking on 'Go to index Page' change the page to index.xhtml page. After this going in and out you will see the counter is stoped. when you click again on 'Begin' button counter start to show enumerate again. My gole is when the user navigate on each page, counter continue and not stop. Thank you for your response.</p>
  
  <p>This Index.xhtml page:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://xmlns.jcp.org/jsf/html"
        xmlns:p="http://primefaces.org/ui"&gt;
  
  &lt;h:head&gt;
      &lt;title&gt;Home Page&lt;/title&gt;
  &lt;/h:head&gt;
  
  &lt;h:body&gt;
  
      &lt;h:form id="mainForm"&gt;
  
          &lt;p:panelGrid id="pnl" columns="3" rendered="true" columnClasses="ui-column-p-2"&gt;
  
              &lt;p:outputLabel id="lblMessage" value="#{test.count}"/&gt;
              &lt;p:commandButton id="btnStart" value="Begin" onclick="PF('poll').start();"/&gt;
              &lt;p:commandButton id="btnTest" actionListener="#{test.gotoOne}" value="Go To Page One"/&gt;
  
          &lt;/p:panelGrid&gt;
  
          &lt;p:poll id="poll"  autoStart="false" listener="#{test.counter}"
                  update="mainForm:lblMessage" widgetVar="poll"/&gt;
      &lt;/h:form&gt;
  
  &lt;/h:body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>And this is one.xhtml page:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://xmlns.jcp.org/jsf/html"
        xmlns:p="http://primefaces.org/ui"&gt;
  
  &lt;h:head&gt;
      &lt;title&gt;Home Page&lt;/title&gt;
  &lt;/h:head&gt;
  
  &lt;h:body&gt;
  
      &lt;h:form&gt;
          &lt;p:commandButton id="pn" actionListener="#{test.gotoIndex}" value="Go To Page Index"/&gt;
      &lt;/h:form&gt;
  
  &lt;/h:body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>At last this is my bean, that generate the numbers:</p>
  
  <pre><code>package bean;
  
  
  import org.primefaces.context.RequestContext;
  
  import javax.faces.bean.ApplicationScoped;
  import javax.faces.bean.ManagedBean;
  import javax.faces.context.FacesContext;
  import java.io.IOException;
  
  @ManagedBean
  @ApplicationScoped
  public class Test {
  
      private int count;
  
      public void counter() {
          count++;
          System.out.println("count = " + count);
      }
  
      public void gotoIndex() {
          try {
              FacesContext.getCurrentInstance().getExternalContext().redirect("index.xhtml");
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  
      public void gotoOne() {
          try {
              FacesContext.getCurrentInstance().getExternalContext().redirect("one.xhtml");
              RequestContext.getCurrentInstance().execute("PF('poll').start();");
          } catch (IOException e) {
              e.printStackTrace();
          }
  
      }
  
      public int getCount() {
          return count;
      }
  
      public void setCount(int count) {
          this.count = count;
      }
  }
  </code></pre>