Skip to main content
14-Alexandrite
August 16, 2019
Solved

How to get View name?

  • August 16, 2019
  • 1 reply
  • 1717 views

Hello friends

 

how is possible to obtain actual View name in JS?

 

thank you for every post.

 

Tomas

Best answer by ClayHelberg

You should be able to use the window.location.hash property to find this, along these lines:

var viewname = window.location.hash.substring(2);

 

1 reply

18-Opal
August 20, 2019

You should be able to use the window.location.hash property to find this, along these lines:

var viewname = window.location.hash.substring(2);

 

14-Alexandrite
August 21, 2019

Hello ClayHelberg

 

Thank you much again. This syntax is exactly what I need.

It works really fine for both -  2D and 3D Views.

 

I tried to put window and window.location to console.log() and I was really suprised how much information I can obtain. This is really inspirative for me.

 

Regards

 

Tomas

 

PS: for the final recap:

/**
* Function return name of active View.
*
* @return (String) - view name.
*/
$scope.getViewName = function() {
var name = window.location.hash.substring(2);
console.log(name);
return name;
}