I have the following function to test
function tradePage() {
setTimeout(function() {
window.location.pathname =
Object.assign(location, { host: "www.newhost.com", pathname: 'file.txt' });
It will update all the location
URL object properties (origin, href, hostname, host
).
so the final href
property will be https://www.newhost.com/file.txt
.
Do this in a beforeEach
block.
just call console.log(location)
to verify the results. Happy coding!