I want call a javascript function defined in parent on child window. I have searched for window.opener and window.parent, but they call function on parent window not on child. Also if it is possible by local storage. Parent window function:
var myFunction=function download() {
console.log("in jsp download")
$("#btnExport").click(function(e) {
e.preventDefault();
//some operation
});
}
window.onload = function() {
localStorage.setItem("storageName",myfunction);
}
Child window
<button id="exportExcel" onclick="localStorage.getItem("storageName")">Export</button>
But this is giving error on child window