Forum Discussion

dhavalu's avatar
dhavalu
Frequent Visitor
10 years ago

Hyperlink not clickable with custom visual.

Hello,

I am working on creating custom visual which creats simple hyperlink using d3js.

Some how when its clicked it dosent open the browser even though the link has proper href and target tags.

I also tried by giving the column appropriate Data Category of Web Url.

Is this due to any security reasons?

Isnt that possible in custom visual?

9 Replies

  • It is because of sandboxed iframes are blocking this behavior

     

    When clicking hyperlink:

    Blocked opening url in a new window because the request was made in a sandboxed frame whose 'allow-popups' permission is not set.

     

    When embedding in iframe:

    Refused to display url in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

    • dhavalu's avatar
      dhavalu
      Frequent Visitor

      Hey Vincent, Thanks for the reply.

       

      Is there any alternative to this. How come the exiting table control render link tag when the column is "Web Url"? Any Idea?

       

      Thanks.

      • vincent_1234's avatar
        vincent_1234
        Helper I

        I have not found any alternative.

        Native visuals can use urls because they are not sandboxed in iframes.

        I understand Microsoft does this for safety so improper developed custom visuals can't collide but it would be nice if we wern't limited in functionality.

  • The following code worked for me while trying to create a custom visual that have a Resolve link which redirects to an API on click. I used the default YourVisual template and added the link as 

    tr.selectAll("td")
    .data(d=> d)
    .enter().append("td")
    .attr('data-th',(d, i) => viewModel.categories[i].value)
    .text(d => this.format(d)).append('a')
    .attr("href", "https://www.google.com")
    .attr("target","_top")
    .text(" Resolve");

     

    Hope this helps.

    • vincent_1234's avatar
      vincent_1234
      Helper I

      This doesn't work for me (either _top or _blank) in both designer and portal