Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6670885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:19:17+00:00 2026-05-26T03:19:17+00:00

We have a frameset (not iFrames !) application where we need to save state

  • 0

We have a frameset (not iFrames !) application where we need to save state of frames that users choose.. and then restore this state next time they hit the page..

Using jQuery as weapon of choice . this is how far we’ve got..

 <frameset rows="40,600,40" id="myframeset" name="myframeset">

     <frame name="mytop" id="mytop" src="http://xyz.com/top.html">

     <frameset cols="50%,50%">
        <frame name="leftframe" id="leftframe" src="http://xyz.com">
        <frame name="rightframe" id="rightframe" src="http://xyz.com">
     </frameset>

     <frame name="mybottom" id="mybottom" src="http://xyz.com/bottom.html">

</frameset>

Running some jQuery in any of the child frames.. ( say mybottom) its easy to pull the row values from the top frameset scope…

var myrows = $('#myframeset', top.document).attr('rows'); 
   alert(myrows);  // returns 40,600,40

and its easy to change the frame heights with jQuery .attr too…

$('#myframeset', top.document).attr({'rows':'0,*,300'});

var myrows = $('#myframeset', top.document).attr('rows'); 
   alert(myrows); // returns 0,*,300

But it seems that when the user moves the frames to change the heights themselves, manually..
it does not affect what attr returns

( move the frames manually then click the button… )

$("button").click(function() {

  var myrows = $('#myframeset', top.document).attr('rows'); 
    alert(myrows);  //  always returns 0,*,300

I feel like there is a simple concept I’m missing here.. please advise
if there is a way we can grab the frameset values (onUnload) put them
in a cookie.. and then restore onload next time user comes to page

Many thanks..

PS.. if this can’t be done with rows/cols .. perhaps with window heights/widths ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:19:18+00:00Added an answer on May 26, 2026 at 3:19 am

    To finish your collection (you’ve already created a function to adjust the rows):

    function getTopRows(){
        var rows = [];
        var main = $("#myframeset", top.document);
    
        //Get the whole height of the main <frameset>
        var wholeheight = $(main).height();
    
        //Calculate the relative height of each frame (child) of the main <frameset>
        main.children().each(function(){
             rows.push(Math.round(100*$(this).height()/wholeheight));
        });
    
        rows = rows.join("%,")+"%"; //Example: 6%,87%,6%
        return rows;
    }
    

    Calling getTopRows() returns a string of relative units, which can be used to set the top rows. This value can be saved by using the JQuery cookie plugin:

    //You can add this function as an event listener to a button
    function saveTopRows(){
        var topRows = getTopRows();
        $.cookie("rows", topRows); //Save data
    }
    
    //Execute on load of the page:
    (function(){//Anonymous wrapper to prevent leaking variables
        var rows = $.cookie("rows");
        if(rows) $("#myframeset", top.document).attr("rows", rows);
    })();
    

    Don’t forget to add the JQuery cookie plugin, either by defining it in the source, or by adding an external JS file. See the JQuery website for the source of the Cookie plugin. After downloading the source, save it as “jquery.cookie.js”, and add this code:

    ...
    <script src="jquery.cookie.js"></script>
    <script>
      function getTopRows(){
      //Rest of code
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the main page that contains multiple frames within the frameset. One of
I have two frames in a frameset - frame[0] contains a script that loads
Say I have 3 frames in a frameset arranged in 3 rows. Frames 1
I have a document which has a nested frameset. I need to access one
I have a frame that's nested in an iFrame. <iframe>..<frameset..><frame id=report> . I have
I have a web application built around a frameset. The main page (with the
I have a web application which is PHP Frameset , with left frame(menu) and
if I have 2 frames of a frameset on 1 page, is there a
I have a Facebook iframe application that I am monetizing via Google Adsense. On
I have developed an application that has a list of items in one frame;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.