title: PHP's strstr() equivalent for JavaScript
body: <p>I wrote this little piece of code for viewing the profile pictures that are set as private. But every time I have to access it, I have to turn Apache on on XAMPP. Also, it is pretty much useless on a computer that doesn't have Apache installed. So I wanted to write it in JavaScript but couldn't find an equivalent for <code>strstr()</code> function.</p>
  
  <p>Could someone please let me know if there's an equivalent or alternative?</p>
  
  <p>The code:</p>
  
  <pre><code>&lt;?php
      //haystack
      $_POST['theaddress'] ='160x160/photo.jpg';
  
      //return all after the needle '160x160/', inclusive
      $varA = strstr($_POST['theaddress'], '160x160/');
  
     //build new URL
      $varA = "https://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-ash3/t1.0-9"."$varA";
  
      header("Location: $varA");
  ?&gt;
  </code></pre>