+ Start a Discussion
vipheviphe 

"Create New Lead" page in an iframe: javascript error

Hi,

I included the standard "create new lead" page in an iframe of my custom Visualpage (via apex:iframe). Unfortunately, in this context, typing in the lead input triggers lots of Javascript errors like the following:

 

Error: 'parentWindow.handleKeyDown' is null or not an object

 

I found out that it was because the Salesforce Javascript (in desktopCommon,js) can't initialize the "parentWindow" variable. As the domain of my custom page ("c.na7.visual.force.com") and the domain of the standard lead creation page ("na7.salesforce.com") are different, an "access denied" error prevents the inialization of 'parentWindow'.

 

Is there a general way to prevent/work-around this category of errors?

Is this behavior limited to the development environment or is it the same in production?

 

Thanks for the help.

Philippe

Pradeep_NavatarPradeep_Navatar

I have done the same but in my case record is getting saved properly. For your error message "Error: 'parentWindow.handleKeyDown’ is null or not an object" : It seems that you are using "window.parent" on your visualforce page inside the script tag if so please use "window.parent.parent" in place of "window.parent'.

 

Hope this helps.

 

vipheviphe

Thank you.

 

I am not exactly using "window.parent" as the only thing I am doing is including a standard page inside a Visualforce page. It seems that the standard pages don't really like being included in such a way because they expect to be able to access information of the top page by Javascript.

 

Saving works anyway in that case. What doesn't is, for instance, deleting: When you delete a record, a confirm dialog is normally displayed but it fails in my case because the Javascript can't access the top page objects. This is actually more important and worrying than the handleKeyDown errors.

 

Philippe

 

kerryland6kerryland6

You are not alone -- we're experiencing exactly the same problem in our production environment. A formal fault is about to be logged with Salesforce...

 

Cheers

Kerry

GoForceGoGoForceGo

Seems like this issue is still not resolved by salesforce and the issue seems to be related to server name - c.na7.visual.force.com" vs. na7.salesforce.com. 

 

This works in orgs created before sometime in 2008, not in more recent orgs.

 

I have added a VF page to standard screen layout. There is some javascript that looks for parent.location and it is null.

 

In the old org, I noticed the form action usr is "action="/servlet/servlet.Integration?lid=06670000000PVYT&ic=1"" while in newer orgs, it includes the visualforce org action =="c.na7.visual.force.com/servlet/servlet.Integration?lid=06670000000PVYT&ic=1"