change the way in which we check url, we copy it from android4.2 source code