Problem with location.pathname.split(‘/’)

Solution for Problem with location.pathname.split(‘/’)
is Given Below:

It returns the text "window.location.pathname.split("https://stackoverflow.com/")[1]" instead the REAL pathname, how could I solve it?

  <script>
     document.getElementById("categoria").innerHTML = 
     "<li style="display:inline;margin-left:5px;margin-right:5px;" class="navbithome"> <a href="https://stackoverflow.com/questions/68612064/index.php{vb:raw session.sessionurl_q}" accesskey='1'><img src="{vb:stylevar imgdir_misc}/navbit-home.png" alt="{vb:rawphrase home}" /></a></li>" + "<a href="javascript:history.back()">window.location.pathname.split("https://stackoverflow.com/")[1]</a>";
  </script>

You must concatenate window.location.pathname.split("https://stackoverflow.com/")[1] with the string you’re assigning to document.getElementById("categoria").innerHTML.

See this question to know how to concatenate strings and variables. In the snippet below, I use template strings.

document.getElementById("categoria").innerHTML =
  `<li style="display:inline;margin-left:5px;margin-right:5px;" class="navbithome">
    <a href="https://stackoverflow.com/questions/68612064/index.php{vb:raw session.sessionurl_q}" accesskey='1'>
      <img src="{vb:stylevar imgdir_misc}/navbit-home.png" alt="{vb:rawphrase home}" />
    </a>
  </li>
  <a href="javascript:history.back()">${window.location.pathname.split("https://stackoverflow.com/")[1]}</a>`;
<ul id="categoria"></ul>