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
Post a Comment