Use an anchor tag for parsing URLs instead of a regex

There are a couple of problems with the regex being used for parsing the Ajax URL and determining if it is same origin:

- Doesn't allow `.` in scheme.
- Doesn't handle leading whitespace.
- Doesn't handle malformed URLs (`https:///google.com`).
- Doesn't enforce that the protocols match.
- Doesn't terminate the host section on `?` or `#`.

The regex could be updated to better match the [URL parsing spec](https://url.spec.whatwg.org/#concept-basic-url-parser), but it is much simpler to let the browser do the heavy lifting for us.

This PR creates an anchor tag and sets it's `href` to the Ajax URL. It then compares the `protocol` and `host` of this anchor tag with those of `window.location`.

/cc @mislav 
I would add parentheses here so that the comparison is more readable.