diff --git a/addons/website/static/src/client_actions/website_preview/website_preview.js b/addons/website/static/src/client_actions/website_preview/website_preview.js index 0ff278a938e..81d22757adc 100644 --- a/addons/website/static/src/client_actions/website_preview/website_preview.js +++ b/addons/website/static/src/client_actions/website_preview/website_preview.js @@ -140,7 +140,7 @@ export class WebsitePreview extends Component { // content of the previous URL before reaching the client action, // which was lost after being replaced for the frontend's URL. const handleBackNavigation = () => { - if (!window.location.pathname.startsWith('/@')) { + if (window.location.pathname === '/web') { window.dispatchEvent(new HashChangeEvent('hashchange', { newURL: window.location.href.toString() })); @@ -296,11 +296,9 @@ export class WebsitePreview extends Component { if (!this.backendUrl) { this.backendUrl = routeToUrl(this.router.current); } - const currentUrl = new URL(this.iframe.el.contentDocument.location.href); - currentUrl.pathname = `/@${currentUrl.pathname}`; - this.currentTitle = this.iframe.el.contentDocument.title; - history.replaceState({}, this.currentTitle, currentUrl.href); - this.title.setParts({ action: this.currentTitle }); + const currentTitle = this.iframe.el.contentDocument.title; + history.replaceState({}, currentTitle, this.iframe.el.contentDocument.location.href); + this.title.setParts({ action: currentTitle }); } _onPageLoaded() { diff --git a/addons/website_sale/static/tests/tours/website_sale_add_to_cart_snippet_tour.js b/addons/website_sale/static/tests/tours/website_sale_add_to_cart_snippet_tour.js index e4560a6fa20..833bfefae84 100644 --- a/addons/website_sale/static/tests/tours/website_sale_add_to_cart_snippet_tour.js +++ b/addons/website_sale/static/tests/tours/website_sale_add_to_cart_snippet_tour.js @@ -44,7 +44,7 @@ wTourUtils.registerWebsitePreviewTour('add_to_cart_snippet_tour', { ...wTourUtils.selectElementInWeSelectWidget('action_picker_opt', 'Buy Now'), ...wTourUtils.clickOnSave(), wTourUtils.clickOnElement('add to cart button', 'iframe .s_add_to_cart_btn'), - wTourUtils.assertPathName('/@/shop/payment', 'iframe button[name=o_payment_submit_button]'), + wTourUtils.assertPathName('/shop/payment', 'iframe button[name=o_payment_submit_button]'), wsTourUtils.goToCart({quantity: 4, backend: true}), wsTourUtils.assertCartContains({productName: 'Acoustic Bloc Screens', backend: true}),