Forum Discussion
Javascript Web URL Prefix in Power BI Desktop Button Action
- 4 years ago
Hi cb1017
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
Hi cb1017
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
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.
- PhilipTreacy4 years agoSuper User