title: Why can I only run 1 JavaScript internal function
body: <p>I am trying to extract the page name from a complex url. <a href="https://stackoverflow.com/questions/7883544/how-to-extract-page-name-from-complex-url">This post</a> is how I am attempting to do this. Now I am able to get the url of the page but once I try to do anything with it it fails. I am using this in a SharePoint page.</p>
  
  <pre><code>//WORKS!
  var url = window.location;
  alert(url);
  
  //ALERTS NOTHING 
  //PREVENTS ALL JAVASCRIPT AFTER THIS FROM RUNNING AS WELL
  var url = window.location;
  var url_parts = url.split(‘/’);
  var main_url = url_parts[0];
  alert(main_url);
  </code></pre>