Check if anchor exists in javascript url prototype javascript

A bit about the basic question, but how can I check if the anchor is in the url on page load?

For example, www.mysite.com/mypage#show

And then in JavaScript I can go if #show exists this

Thanks.

+2


a source to share


1 answer


plain js:



if( window.location.hash == '#show' )

      

+2


a source







All Articles