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 -

ubuntu - Bash Script to Check That Files Are Being Created -

Php operator `break` doesn't stop while -