2

I developed a web part that is loading a dialog, something like:

var dialog = SP.UI.$create_DialogOptions();
dialog.url = '_layouts/page.aspx';

etc..

Inside this dialog I have several stuff and what I want to do is to load an iframe and that iframe should access the javascript code from its parent. When I try to do this:

parent.triggerFunction()

it complains about cross domain issues. How can I solve this? I'm using SharePoint 2010

  • What version of SharePoint are you using? – lwbecker2 Mar 10 '14 at 14:17
  • sharepoint 2010 – nhenrique Mar 10 '14 at 14:24
1

For Silverlight Client Side Object Model applications you need to configure some cross domain access policies via one or more XML files.

CrossDomain.xml and ClientAccessPolicy.xml are the files that control this for client-side object model access in SharePoint 2010 with SilverLight. There may be simliar configuration steps that are needed for ECMAScript / JavaScript to work.

1

Sounds like you want to do cross-window messaging via postMessage. Plenty of tutorials on the web, here's one I've found from a quick Google: http://javascript.info/tutorial/cross-window-messaging-with-postmessage

0

To access the script in iframe page (from different domain), you need to use javascript postmessage function, since direct script communication is not allowed when the domains of iframe and parent pages differs. Please refer this link for further details.

https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.