javascript - Provider hosted app in sharepoint openened with sharepoint modal. How to close it from inside the app -


i've created provider hosted app runs on azure website. in sharepoint open page in modal dialog follows:

origin = encodeuricomponent(origin); var pageurl = baseurl + '&origin=' + origin + '&controller=' + controller; var options = sp.ui.$create_dialogoptions(); options.width = 800; options.height = 1000; options.title = 'ptw registration form'; options.url = pageurl; options.dialogreturnvaluecallback = function.createdelegate(null, ondialogclose); sp.ui.modaldialog.showmodaldialog(options); 

this works. on our page have custom close button trigger ajax request , modal should closed.

only problem following code doesn't anything.

window.parent.postmessage('closecustomactiondialognorefresh', '*'); 

and with

window.frameelement.commonmodaldialogclose(1 /*ok*/, 'closed ok result'); 

it gives security error...

anyone encountered similar?


Comments