Javascript 如何检查location.hash是否有`#access_token=`并且如果有,做些什么?
现在,我正在为我的Auth0登录执行以下操作-Javascript 如何检查location.hash是否有`#access_token=`并且如果有,做些什么?,javascript,Javascript,现在,我正在为我的Auth0登录执行以下操作- if (location.hash) { // do something } 我如何确保它仅在包含#access\u token=时才执行此操作 像这样使用indexOf if(location.hash.indexOf("#access_token=" > -1) { // Do stuff } 您可以在indexOf上了解更多信息
if (location.hash) {
// do something
}
我如何确保它仅在包含
#access\u token=
时才执行此操作 像这样使用indexOf
if(location.hash.indexOf("#access_token=" > -1) {
// Do stuff
}
您可以在indexOf
上了解更多信息