0

I am trying to access the variables of child page in parent page without refreshing. I have tried the session but to read the session i have to click a button in parent page which I can't do. I have two pages parent.asp and child.asp, when I click a button on parent.asp second page child.asp is opened and the form is filled there I want to post these form values to parent page without refreshing the parent page and also without any other button click (worked on session but to read the session again I have to click the button which I don't want to do).

Please help me, thanks.

sshashank124
  • 31,495
  • 9
  • 67
  • 76
Ahmed
  • 39
  • 8
  • 2
    Please show your code. – Seany84 Mar 22 '14 at 11:13
  • Does the child page have to be a new, fully qualified, browser window? I find that in this world of tabbed browsers that it has be become a better idea to scope children in the page that created it. I other words, an I frame as old school as it sounds. Then you can slush data to and from ref: http://stackoverflow.com/questions/935127/how-to-access-parent-iframe-from-javascript – Hardrada Mar 22 '14 at 15:20

2 Answers2

0

A solution could be using a basic encryption algorithm and just saving the variables in localstorage. That way the data would be protected from other websites the user visits but pages that you have given a key to could access the variables.

An example of this is below.

<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/aes.js"></script>
<script>
    var store = {
        put: function(id, variable, password){
            localStorage.setItem(
                id, 
                CryptoJS.AES.encrypt(variable, password)
            );
        },
        pull: function(id, password){
            return  CryptoJS.AES.decrypt(
                localStorage.getItem(id), 
                password
            );
        },
    };
 </script>
nathanhorton
  • 100
  • 1
  • 8
-1

I get that by using

window.opener.document.getElementById('textbox1').value = document.getElementById('textboxchild').value

Thanks for your help and techhead55 good encryption method thanks for that one too.

Balaji Kandasamy
  • 4,446
  • 10
  • 40
  • 58
Ahmed
  • 39
  • 8