Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  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>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement