我正在使用window.open()
將我的客戶重定向到新網站。我想在該網站加載之前顯示一些消息或圖像。在彈出窗口中顯示負載信息
這是我的代碼。
<input class="btn add-to-cart-btn" onclick="two();"
type="button" value="More Info At {{ product.vendor }}"/>
JavaScript代碼:
<script>
function two()
{
window.open('{{ product.metafields.google.custom_label_0 }}'); trackOutboundLink('{{ product.metafields.google.custom_label_0 }}'); }
alert("please wait your page is loading ");
var trackOutboundLink = function(url) { ga('send', 'event', 'outgoing', 'click', url, { 'transport': 'beacon' });
}
</script>
這裏{{ product.metafields.google.custom_label_0 }}
是一個動態的URL。測試警報消息顯示在同一頁面中。
有幫助嗎?
你想在新窗口中顯示的消息? – Mohammad