SHARE
TWEET

Untitled

a guest Feb 20th, 2019 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3.     <title>Frontend</title>
  4. </head>
  5. <body>
  6. <h1 id="route">Current route: </h1>
  7. <script>
  8.     // Base URL under which the frontend SPA is running
  9.     const baseUrl = '/view';
  10.     // Get complete path after the hostname + port
  11.     const pathname = location.pathname;
  12.     // Determine current route, by removing the base URL from the path name
  13.     const currentRoute = pathname.replace(new RegExp('^' + baseUrl), '');
  14.     // Output route
  15.     const header = document.getElementById('route');
  16.     header.innerText += currentRoute;
  17. </script>
  18. </body>
  19. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top