add permission screening to javascript