mixpanel / mixpanel-js

Official Mixpanel JavaScript Client Library
https://mixpanel.com/help/reference/javascript
Other
867 stars 309 forks source link

Target attribute other than _blank is ignored. #413

Open WebproJoeZ opened 4 months ago

WebproJoeZ commented 4 months ago

We have noticed during our testing that when a url is passed through mixpanel javascript client, the target attribute with a value other than _blank is ignored. Therefore, no new tabs are opened, the linked page is opened in the original window.

Our very naive solution is to change this condition in mixpanel.js from element.target === '_blank' to !(element.target.trim() === "")

to allow the target value to pass through. We are not aware of the reasons behind only allowing _blank.

Thanks.

cpanel-jared commented 2 months ago

To update, the following change worked for us as isEmpty() was causing problems.

!!element.target.trim()