Window location problem

Hello.
I am trying to define a clickable image to take the current page url and open the very same page in a different domain.
For instance, when I am on that page:
www.domain-one.com/page100
a click on that image will automatically send the user to:
www.domain-two.com/page100.

I am trying to do it like this:

$w.onReady(function () {
    $w("#image10").onClick( (event, $w) => {
  window.location.href.replace(window.location.origin, window.location.protocol + "//www.domain-two.com/");  // "#image10"
} );

});

But it doesn’t work.
Please help :slight_smile:
Thank you!

1 Like

Hello,
Try using wix-location api instead, as it is the intended way for WixCode app to interact with browser’s location api.

1 Like