Jump to content

Recommended Posts

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.