Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to call unload event of iframe

I used jquery to show multiple child.aspx pages in different tabs in my parent.aspx page.

$('#tabcontent').append(
'<iframe width="100%" frameborder="0" 
scrolling="no" 
onload="adjustMyFrameHeight(' + count + ');"
id="c' + count + '" src="' + srcpage + '" >' + '</iframe>)

Now I want to call the Page_Unload method of all the child.aspx pages on parent Unload.

What I need is to store the information on each child.aspx page in the session and then reassign the session to each page.

like image 724
Sumit Pannu Avatar asked Nov 26 '25 18:11

Sumit Pannu


1 Answers

try using innerHTML.They also only clear document.body (anything in the <head> is still present). Here is a solution that uses the DOM:

var frame = document.getElementById("myFrame"),
frameDoc = frame.contentDocument || frame.contentWindow.document;
frameDoc.removeChild(frameDoc.documentElement);

This solution uses innerHTML:

var frame = document.getElementById("myFrame"),
frameDoc = frame.contentDocument || frame.contentWindow.document;
frameDoc.documentElement.innerHTML = "";

replace myFrame by id of that frame.

like image 91
Milind Anantwar Avatar answered Nov 28 '25 15:11

Milind Anantwar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!