You need to sign in to do that
Don't have an account?
Base Line 7
Using pagereference to navigate to a webpage
I have added a custom button to a page that should navigate to a web page (https://www.google.com) when it is clicked. However, I get an error message stating, "Page doesn't exist. Enter a valid URL and try again." Here is the code I wrote for the navigation:
var navigService = cmp.find("navService"); var PageReference = { type: 'standard__webpage', attributes: { url: 'https://www.google.com' } }; navigService.navigate(PageReference);Looking at the documentation provided by Saleforce, this should work without any problem but that does not seem to be the case. Can someone please help me to figure out why it is not working? Thanks in advance.
Greetings to you!
You need to use standard__webPage instead of standard__webpage as lightning is case sensitive, it is based on aura framework which is a type of JavaScript and JavaScript is case sensitive.
Try below code:
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
All Answers
Greetings to you!
You need to use standard__webPage instead of standard__webpage as lightning is case sensitive, it is based on aura framework which is a type of JavaScript and JavaScript is case sensitive.
Try below code:
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas