ginerjm Posted May 23, 2012 Share Posted May 23, 2012 I have a form that opens up a login window Once the user logs in correctly, I run some js to modify an element on my main window (the caller) and then I close my login window (the child). This script and the js work just perfectly on my IE tests, my Safari test on a PC and my iphone 4 but my ipad has a problem with my js. I've tried to find how to do this and have used two diff methods to try and get around the problem, but I'm getting nowhere. I was using window.opener.document.getElementById('idname').innerHTML="something"; in the child window. Then I read about this method logwin = window.open(......); logwin.idxpage = self; in my calling window and then this: ... idxpage.getElementById('idname'].innerHTML = "something"; in the child window, but this fails telling me that 'undefined is not an object'. I also tried: self.idxpage.getElementById('idname').innerHTML = "something"; in the child, but that doesn't get recognized either. I've been re-reading my code for an hour and I've reread the articles I used over and over. Again - this works great on my IE and Safari and iphone - just not the ipad. Quote Link to comment https://forums.phpfreaks.com/topic/262964-trying-to-modify-an-element-on-a-caller-form-from-a-child-window/ Share on other sites More sharing options...
ginerjm Posted May 23, 2012 Author Share Posted May 23, 2012 A new day - new work being tried. I've added the following to my code and am displaying the function that is failing me below. First - a little function that really doesn't help me, but adds to the paradox of things. function checkOpener() { console.log("entering checkOpener"); if (window.opener == null) { alert("There is no window.opener available"); console.log("exiting checkOpener with false"); return false; } else { console.log("exiting checkOpener with true"); return true; } } This function returns true every time, I guess 'window.opener' is present, but the properties under it aren't. function ShowWelcome(uid) { console.log("entered showwelcome"); if (!checkOpener()) return; console.log("Attempting first uidobj"); uidobj = window.opener.getElementById('uid'); console.log("uidobj at step2 is "+uidobj); uidobj.innerHTML = "Welcome "+uid; console.log("leaving showwelcome"); return; } I never get the console message "... at step 2...". Adding the displays to the console log helps to confirm that the window.opener is just plain not functioning when running on an iPad. Additionally, the following code in my "close" function also fails: function CloseMe() { console.log("Entering closeme function"); if (checkOpener()) { console.log("in closeme href is "+window.opener.location.href); window.opener.location.href = window.opener.location.href; } self.close(); } This code is supposed to refresh the calling window (in order to pick up some newly available info now that the user is logged in. It works fine on my iphone, my IE and Safari on the PC. On the ipad however, it shows that href is undefined in the console, and the close actually sends me to a url of "...../undefined" due to the reloading of the href property here. Hope this intrigues and/or helps someone to give me an idea. There doesn't seem to be much about iPads and this problem available to search on. Quote Link to comment https://forums.phpfreaks.com/topic/262964-trying-to-modify-an-element-on-a-caller-form-from-a-child-window/#findComment-1347957 Share on other sites More sharing options...
Kays Posted May 23, 2012 Share Posted May 23, 2012 Use a modal. It is simpler, more user-friendly, and more elegant. Quote Link to comment https://forums.phpfreaks.com/topic/262964-trying-to-modify-an-element-on-a-caller-form-from-a-child-window/#findComment-1347981 Share on other sites More sharing options...
ginerjm Posted May 23, 2012 Author Share Posted May 23, 2012 Except - modal isn't cross-browser compatible. Quote Link to comment https://forums.phpfreaks.com/topic/262964-trying-to-modify-an-element-on-a-caller-form-from-a-child-window/#findComment-1348022 Share on other sites More sharing options...
Kays Posted May 23, 2012 Share Posted May 23, 2012 Except - modal isn't cross-browser compatible. Is that a fact? Can you prove it? Quote Link to comment https://forums.phpfreaks.com/topic/262964-trying-to-modify-an-element-on-a-caller-form-from-a-child-window/#findComment-1348026 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.