A more complete solution for absolute urls and protocol relative urls