cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dhavalu Frequent Visitor
Frequent Visitor

Can we add external javascript file to custom visual?

Hello,

Can we add external javascript file to custom visual?

If yes can anyone point me at some code or link.

I have tried few things like $.getScript(), reference path but no luck.

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
vincent_1234 Regular Visitor
Regular Visitor

Re: Can we add external javascript file to custom visual?

Take a look at the QuillWrapper in the textbox visual, it loads javascript dynamically.

You can refer to a CDN or self hosted (needs to be https)

6 REPLIES 6
Super User
Super User

Re: Can we add external javascript file to custom visual?

I won't say no but I would be fairly surprised if this was allowed for security concerns alone.


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!


vincent_1234 Regular Visitor
Regular Visitor

Re: Can we add external javascript file to custom visual?

Take a look at the QuillWrapper in the textbox visual, it loads javascript dynamically.

You can refer to a CDN or self hosted (needs to be https)

pchapple Member
Member

Re: Can we add external javascript file to custom visual?

@vincent_1234 hello, sorry for jumping on someone elses thread.  When you say "textbox visual", do you mean the basic textbox which is available in the ribbon bar.  Or are you referring to a Custom Visual?  Im trying to embed a short java script to recall a map from an external https website.

 

Thanks!

alex-potter Regular Visitor
Regular Visitor

Re: Can we add external javascript file to custom visual?

I was able to use getScript to grab the leaflet library for a mapping visual         

             $.getScript("https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js", function (data, textStatus, jqxhr) {
//do stuff
}

Alex 

Alex Potter
Lead Visualization Engineer
Luxoft Inc.
pchapple Member
Member

Re: Can we add external javascript file to custom visual?

Thanks @alex-potter

sorry for the question, but Im completely new to this side of Power BI.  How do I add this into a power BI report?  

Highlighted
alex-potter Regular Visitor
Regular Visitor

Re: Can we add external javascript file to custom visual?

You are going to want to leverage it in your custom visual code.  Documentation on how to get started can be found here: https://github.com/Microsoft/PowerBI-visuals

 

Alex 

Alex Potter
Lead Visualization Engineer
Luxoft Inc.