We have answer of your question!

100% solved queries, no empty question

Question: Javascript: How to reload entire frameset onload() event including frame where Javascript is called


0

Is there a way to reload an entire frameset using Javascript onload() event?

function logout()
{
    ...
    // reload entire frame
    top.location.reload();
}
<body onload="logout()">

This cause all frames to reload but the URL of the frame where this was called didn't changed to the URL specified in the framset.

Question author Ksuralta | Source

Answer


1


As I understood it, you want to reload each frame in a frameset using the original URL as stated in <frame src="...">.

This little function can do that (put it into the document holding the frameset):

this.reloadChildFrames = function()
{
    var allFrames = document.getElementsByTagName("frame");
    for (var i = 0; i < allFrames.length; i++)
    {
        var f = allFrames[i];
        f.contentDocument.location = f.src;
    }
}

You are then able to call that function from within any child frame:

top.reloadChildFrames()

Of course, this can only work when all frames come from the same origin.

Answer author Tomalak

Tickanswer.com is providing the only single recommended solution of the question Javascript: How to reload entire frameset onload() event including frame where Javascript is called under the categories i.e javascript , . Our team of experts filter the best solution for you.


You may also add your answer

Thanks for contributing an answer to Tick Answer!