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

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

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