html - Match only one URL with Javascript -



html - Match only one URL with Javascript -

i have code:

if (!window.location.href.match(/\?snake=/)) {

which redirects user if go site.com/snake. problem matches url starting same keyword , endless loop:

site.com/snake-mobile

how can avoid that? , match url ends snake?

you utilize href.endswith("snake"). used endswith ecmas 6 function usefull isn't compatible web browsers.

javascript html

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -