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

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

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