title: chrome extention popup window automatically closed
body: <p>i create a simple chrome extention that take a image as an input from the user ... after that i upload that image to cloudinary through api call ...
  but the problem is when i open popup and select a image atfer that popup window is automatically close. when i open it again it will refresh and my selected image file was gone</p>
  <p>this is my popup.html file</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang=&quot;en&quot;&gt;
  &lt;head&gt;
     &lt;meta charset=&quot;UTF-8&quot;&gt;
     &lt;title&gt;My Chrome Extension&lt;/title&gt;
     &lt;link rel=&quot;stylesheet&quot; href=&quot;popup.css&quot; /&gt;
  &lt;/head&gt;
  &lt;body&gt;
   &lt;form action=&quot;&quot;&gt;
  
     &lt;div style=&quot;padding: 20px 20px 20px 20px;&quot;&gt;           
       &lt;h3&gt;Hello,&lt;/h3&gt;
       &lt;p&gt;Please enter your name : &lt;/p&gt;         
       &lt;input id=&quot;name_textbox&quot; type=&quot;file&quot; value=&quot;&quot; /&gt;  
       &lt;button id=&quot;btn&quot; &gt; submit&lt;/button&gt;   
       &lt;a href=&quot;&quot;&gt;click here&lt;/a&gt;              
       
   &lt;/div&gt;  
   &lt;/form&gt;
  
   &lt;script src=&quot;popup.js&quot;&gt;&lt;/script&gt;
  
   
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>this is my popup.js</p>
  <pre><code>const input = document.getElementById('name_textbox')
  const link = document.getElementsByTagName('a')
  document.getElementById(&quot;btn&quot;).addEventListener('click',check)
  function check(e){
  e.preventDefault()
    const  val = input.files[0];
   
  
   const form = new FormData();
  
      form.append(&quot;file&quot;, val);
      form.append(&quot;upload_preset&quot; , 'unsigned_name')
      const url = &quot;https://api.cloudinary.com/v1_1/name/image/upload&quot;
    fetch(url , {
      method: &quot;POST&quot;,
      body:form
      
    }).then((res)=&gt; res.json()).then((res)=&gt;{
      console.log(res);
      link.href = res.url
    })
    
    
   
  }
  </code></pre>
  <p>anyone can please help me to solve this problem</p>