Created
March 18, 2016 15:59
-
-
Save beckettkev/605e716393ba61df8cd9 to your computer and use it in GitHub Desktop.
Loading a SPModal window in SP passing the parent window location
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getWindowLocation() { | |
| var caller = ''; | |
| ['protocol','//','hostname','pathname'].forEach(function(item, i) { | |
| caller += item === '//' ? item : window.location[item]; | |
| }); | |
| return caller; | |
| } | |
| function loadTemplatePicker() { | |
| var _options = { | |
| tite : 'Template Picker', | |
| url : <INSERT URL HERE>, | |
| allowMaximize : false, | |
| showClose : true, | |
| autoSize : true, | |
| width: 560, | |
| height : 560, | |
| args: { parentLocationUrl: getWindowLocation() }, | |
| dialogReturnValueCallback : close | |
| }; | |
| SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', _options); | |
| } | |
| //Meanwhile we will need to get the property on the target page being loaded in the modal window... | |
| var args = SP.UI.ModalDialog.get_childDialog().get_args(); | |
| console.log(args.parentLocationUrl); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment