You need to sign in to do that
Don't have an account?
Pasan Eeriyagama
Getting Lightning run-time exception: SecureWindow.open supports http://, https:// schemes and relative urls
Hi,
I'm trying to print preview a lightning component using below.
But it's throwing Lightning exception as below.
Any suggestions/workaround to get this working please. Thanks.
I'm trying to print preview a lightning component using below.
printPreview: function(component, event, helper) { var yourDOCTYPE = "<!DOCTYPE html>"; var printPreview = window.open('about:blank', 'print_preview', "resizable=yes,scrollbars=yes,status=yes"); var printDocument = printPreview.document; printDocument.open(); printDocument.write(yourDOCTYPE+ "<html>"+ document.documentElement.innerHTML+ "</html>"); printDocument.close(); },
But it's throwing Lightning exception as below.
Any suggestions/workaround to get this working please. Thanks.
I guess it's due to the locker service
Custom components run in “User mode” and don’t have access to the real Document or real “window” object.
That's why the above code will never work in Lightning Components.
Hope this helps.
Regards,
Nagendra