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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
amassip
Helper I
Helper I

Custom visual open new report

Hello everybody

 

I want to know if it is possible to open a new powerBI report when the user clicked on a custom visual ?

 

 

var elements = document.getElementsByClassName("class");
			for(var x=0; x<elements.length; x++)
			{
			  elements[x].addEventListener("click", function(e) {
				window.top.location.href = url;
			  });
			} 

I got the following error :

 

Refused to display 'https://myurl.com/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

 

So I know the header depends of the owner but I wonder if I missed something else ?

 

Thanks

 

 

 

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@amassip,

 

So far, I do not find an available way. You may submit an idea.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I am able to display hyperlink with this code:

 

'<a onclick=parent.postMessage("childframe","*");> '+ click here +' </a>'

 

But when i click on 'click here' it doesn't transfer the message even if the event is reached

 

window.addEventListener("message", function (event) {
   console.log(event.data); //display data but not the parameter
});

 

Update

 

With this 

 

'<a onclick=window.postMessage("childframe","*");> '+ task.typeDate.type+' </a>'

And this code :

 

// Create IE + others compatible event handler
var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
var eventer = window[eventMethod];
var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";

// Listen to message from child window
eventer(messageEvent, function (e) {
    console.log('parent received message!:  ', e.data);
}, false);

I can see my parameter but the origin source is unknwon so it is not safe at all

@amassip,

 

You could also reach out for help on GitHub and keep an eye on Custom Visuals blog for the latest info.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.