title: How to remove external JS when navigate to another page VUEJS
body: <p>I have java script component in home component with external js. I need to remove external js when page navigate to another page. Page does not refresh.</p>
  <pre><code>&lt;script&gt;
    function initFreshChat() {
      window.fcWidget.init({
        token: &quot;***&quot;,
        host: &quot;https://wchat.freshchat.com&quot;
      });
    }
    function initialize(i,t){var e;i.getElementById(t)?initFreshChat():((e=i.createElement(&quot;script&quot;)).id=t,e.async=!0,e.src=&quot;https://wchat.freshchat.com/js/widget.js&quot;,e.onload=initFreshChat,i.head.appendChild(e))}function initiateCall(){initialize(document,&quot;freshchat-js-sdk&quot;)}window.addEventListener?window.addEventListener(&quot;load&quot;,initiateCall,!1):window.attachEvent(&quot;load&quot;,initiateCall,!1);
  &lt;/script&gt;
  </code></pre>
  <p>This is the external js: <a href="https://wchat.freshchat.com/js/widget.js" rel="nofollow noreferrer">https://wchat.freshchat.com/js/widget.js</a></p>
  <p>I need this because i need to keep this freshchat window in one page.
  This can be done by putting any condition. But it will works if we refresh the page. Here pages are not refreshing at all.
  Therefore I need to remove the external js when navigate to another pages. And mount back when came to this page.</p>