Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
cb1017
Regular Visitor

Javascript Web URL Prefix in Power BI Desktop Button Action

Hello!

 

I'm new to Power BI Desktop (this is my first community post) and am trying to format a button action in one of my reports to direct to a public Web URL. I am trying to make the URL open in a new, re-sized browser window. If I append a javascript:window.open( prefix in front of my 'https://...' URL, the URL opens exactly how I want it to in my web browser (which is Google Chrome, FWIW). However, the Web URL action does not recognize/allow this prefix when I enter it in PBI Desktop; the field turns red (see screenshot) and the URL opens with only the https:// prefix, therefore not formatting/re-sizing the window in the way that I want.

 

I've scoured the web for answers to this question/issue, and it seems like PBI Desktop may not allow for any such javascript commands; at least not in the manner in which I'm attempting to do this. Can anyone please confirm this, and if that is the case, are there any other alternative ways to accomplish what I am seeking? I am working in PBI Desktop Version: 2.93.1681.0 64-bit

(May 2021). Thank you!

 

PBIDesktop_WebURLError.png

 

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @cb1017 

 

Download sample PBIX file.

 

It's not functionality in PBI, it's JavaScript that runs from inside an HTML file.  You set the URL on your button in PBI to load the file which is located on some public website - I'm using Amazon S3.  The file then creates a new window and loads the site you want.

 

For example, here's a HTML file that creates a new window and loads a website into it

 

https://d13ot9o61jdzpp.cloudfront.net/files/pbiforum/OpenWindow.html

 

Here's the source code for this file

<!DOCTYPE html>
<html>
<body>

<p>Open a new window using JavaScript function.</p>


<script>
var myWindow;

function openWin() {
  myWindow = window.open("https://www.myonlinetraininghub.com", "MOTH", "width=800, height=600");
}

openWin();

</script>

</body>
</html>

 

Change the window size and the URL of the site you want to load.

 

Note that your browser may block a new window as a 'pop-up' in which case you need to allow this new pop-up window to appear in your browser.

 

Check out my example PBIX file (above) which has a button that loads this HTML file and creates a new window for the website to load into.

 

Regards

 

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

5 REPLIES 5
PhilipTreacy
Super User
Super User

Hi @cb1017 

 

Download sample PBIX file.

 

It's not functionality in PBI, it's JavaScript that runs from inside an HTML file.  You set the URL on your button in PBI to load the file which is located on some public website - I'm using Amazon S3.  The file then creates a new window and loads the site you want.

 

For example, here's a HTML file that creates a new window and loads a website into it

 

https://d13ot9o61jdzpp.cloudfront.net/files/pbiforum/OpenWindow.html

 

Here's the source code for this file

<!DOCTYPE html>
<html>
<body>

<p>Open a new window using JavaScript function.</p>


<script>
var myWindow;

function openWin() {
  myWindow = window.open("https://www.myonlinetraininghub.com", "MOTH", "width=800, height=600");
}

openWin();

</script>

</body>
</html>

 

Change the window size and the URL of the site you want to load.

 

Note that your browser may block a new window as a 'pop-up' in which case you need to allow this new pop-up window to appear in your browser.

 

Check out my example PBIX file (above) which has a button that loads this HTML file and creates a new window for the website to load into.

 

Regards

 

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Thank you so much for this excellent guidance, Phil! I worked with my Application Development team and it seems like we have now gotten our URLs to do exactly what we wanted. I am grateful for your assistance.

You're welcome @cb1017 

 

Glad you found a solution to your problem 🙂

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


PhilipTreacy
Super User
Super User

Hi @cb1017 

You can only use a URL in the form https://...........

As a workaround you could use a URL to load a file that runs JS to resize the window.

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Thank you for your quick reply, Phil! 

 

Please forgive my ignorance, but may I kindly ask how this can be done? I'm not familiar with this functionality in PBI Desktop.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.