1

How would like to with javascript find a cookie that starts with 'AzureAppProxyAccess' and delete that cookie? It always has a series of random numbers at the end of the name. It is in the same domain so I have access to it. This is what I have tried with jquery but I would like just javascript.

for (cookie in $.cookie()) {
    if(cookie.substring(0, 19) === "AzureAppProxyAccess") { 
        $.removeCookie(cookie);
    } 
};
Oshadha
  • 546
  • 10
  • 25
llerdal
  • 377
  • 1
  • 4
  • 16

1 Answers1

0

You can use indexOf in strings.

cookie.indexOf('AzureAppProxyAccess') > 1 ? doSomething : somethingElse

Or, like it was said in one of the comments, use RegEx.

Baruch
  • 2,381
  • 1
  • 17
  • 29