The company I work for updated its DNS settings in our country and now a lots of old links without fully qualified domain name don't work anymore.
Before:
http://server:8080/something
After:
http://server.company.com:8080/something
But other countries and servers still use the old format (they will be migrated over the coming years) and we get a lot of old links in mail and chat and when we click those the browser can't open them.
I would like to write a bookmarklet that replaces the old URL to the new one, something like:
javascript:window.location.href=window.location.href.replace(/(^http:\/\/[^.]*):/,'$1.company.com:')
Unfortunately, the bookmarklet doesn't work because the page was not loaded and thus window.location.href
does not contain the URL to be replaced.
Can I somehow still access the URL that was entered in the browser's location bar?
Or there is no way and I need to create a browser extension for that?