Code Snippet:
I have created a page and added the Script Editor Web Part.
  1. <script type="text/javascript">
  2. // Using the DialogOptions class
  3. function OpenDialog(strPageURL) {
  4. var dialogOptions = SP.UI.$create_DialogOptions();
  5. dialogOptions.url = strPageURL; // URL of the Page
  6. // Width of the Dialog
  7. dialogOptions.width = 800;
  8. // Height of the Dialog
  9. dialogOptions.height = 630;
  10. // Function to capture dialog closed event
  11. //dialogReturnValueCallback - A function pointer that specifies the return callback function. The function takes two parameters, a dialogResult of type SP.UI.DialogResult Enumeration and a returnValue of type object that contains any data returned by the dialog.
  12. dialogOptions.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback);
  13. // Open the Dialog
  14. SP.UI.ModalDialog.showModalDialog(dialogOptions);
  15. return false;
  16. }
  17. // Dialog close event capture function
  18. function CloseCallback(strReturnValue, target) {
  19. if (strReturnValue === SP.UI.DialogResult.OK) {
  20. }
  21. if (strReturnValue === SP.UI.DialogResult.cancel) {
  22. }
  23. }</script>
  24. <div><a onclick="return OpenDialog("https://c986.sharepoint.com/SitePages/Test.aspx");"
  25. href="https://c986.sharepoint.com/SitePages/Test.aspx">
  26. Click here to show Modal Dialog</a></div>
Result:
Reference:
https://msdn.microsoft.com/en-us/library/office/ff410058(v=office.14).aspx.