Redirect to a new tab | XM Community
Skip to main content

I have an end of survey block that redirects the users to a new URL. I would  like that new url to open in a new tab. Is that possible? 

 

As a workaround, I tried using the advice of a different post and insert JavaScript into an end of survey message, but the below script isn’t redirecting the user. 

 

<script>

setTimeout(function() { window.open("https://www.wikipedia.org", "_blank");

}, 1000);

 

</script>

Did you try to save link under HTML like this.

<a class="myLink" href="https://www.wikipedia.org" target="_blank"> CLICK HERE NOW </a>

then click .myLink

<script type="text/javascript">
$(function(){
$('.myLink').trigger('click');
});
</script>



OR



<script type="text/javascript">
$(function(){
window.location.href = $('.myLink').attr('href');
});
</script>

 


@ArunDubey Thank you for your reply. The problem that I’m having is that I want an automatic redirect in a new tab. Both of your options successfully open the link in a new tab, but I would like them to be redirected automatically to a new tab. 


Leave a Reply