Open a Link in a New Browser Tab Without Being Blocked in Creatio

If you need to open a link in a new browser tab in Creatio, the most common way to do that might be using standard javascript window.open code like the following:

window.open("https://customerfx.com/", "_blank"

The problem with this approach is that code will often get blocked by the browser’s popup blocker and won’t open unless the user notices it was blocked and tells the browser to allow it (if they even notice it was blocked, however, chances are that users will just think it didn’t work and move on)

A better approach that is less likely to get blocked by the browser is to programmatically add an anchor tag to the page, then simulate a click of it, and then remove it from the page. While that might seem like a lot, the code is really pretty simple. Let’s take a look:

var link = document.createElement("a");
link.href = "https://customerfx.com/";
link.target = "_blank";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);

There’s still a possibility the browser might block this, but the chances are far less likely. Usually this approach won’t get blocked as a popup by the browser since it appears as the user clicked a hyperlink.

ABOUT THE AUTHOR

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!