Quantcast
Channel: All Developer posts
Viewing all articles
Browse latest Browse all 48400

Re: Custom visual open new report

$
0
0

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


Viewing all articles
Browse latest Browse all 48400

Trending Articles