To catch the event to restart the frame?

In the browser there is a possibility as the restart frame if there is one. Whether it is possible to capture this event through javascript?
June 14th 19 at 18:22
3 answers
June 14th 19 at 18:24
Not tried it myself - this is just an idea:

When you restart the frame, the idea is to trigger your onbeforeunload event, because the document loaded into a frame, unloaded. You can try to catch this event and send info to the parent window.
It does not catch this action ... - Chaya_Goldner commented on June 14th 19 at 18:27
June 14th 19 at 18:26
Just otlavlivatsya the onload event of the frame:

<iframe id="myframe" src="..." onload="frameReload(this)"></iframe>
It does not catch this action ... - Chaya_Goldner commented on June 14th 19 at 18:29
June 14th 19 at 18:28
You need to catch the event 'your onbeforeunload' on the contentWindow of a frame

Example with jQuery:
var $iframe = $('#iframe');
$iframe.load(function () {
 $iframe[0].contentWindow.your onbeforeunload = function () {
 console.log('restart Frame')
};
});


JQuery also has a method https://api.jquery.com/unload/
Also hung up on $iframe[0].contentWindow
js error issues, is it possible var $iframe ? - Chaya_Goldner commented on June 14th 19 at 18:31
in the example used the jQuery library https://jquery.com/ connect it, it will simplify the reference to the DOM and many other things) - Chaya_Goldner commented on June 14th 19 at 18:34
I have connected jquery.min.js jQuery v3.2.1 - Chaya_Goldner commented on June 14th 19 at 18:37
then , what errors produces? - sherwood31 commented on June 14th 19 at 18:40
this code with no issues on my working code... - Chaya_Goldner commented on June 14th 19 at 18:43
and maybe not to my

Uncaught SyntaxError: Unexpected token =

Judging by the error line code is mine, but without you there is no error ... - sherwood31 commented on June 14th 19 at 18:46

Find more questions by tags JavaScript