javascripthtmlinspect-element

Get sent to an class by URL


I know this is a little bit hard to understand, but I've seen some sites using the ID of an element in the url to send you somewhere, and I was wondering if it's also possible with classes.

I don't think this is private or something like that because anyone can get it by inspecting the page. I also tryed with a dot (".class"), but it unfortunately didn't work.

So is there another way of doing this with other than IDs?


Solution

  • You cannot do this with classes because they're not unique. The browser needs to know exactly where to send you, and using a class name instead of an ID would be ambiguous.