function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Denise CrosbyDenise Crosby 

need help with trailhead: Visualforce Basics

Hello. This is a really newbie question but I haven't done coding in a while and got stuck. The Visualforce Basics trailhead says to Open your browser’s JavaScript console and enter the following code for format your Visualforce page with Lightning.

$A.get("e.force:navigateToURL").setParams(
    {"url": "/apex/pageName"}).fire();

I know how to get to the Chrome DevTools, but how do you run Javascript inside it?
Best Answer chosen by Denise Crosby
Alain CabonAlain Cabon
Hi Denise,

This part is badly explained and it is the only time that I had done this with the trailhead modules and because I had taken javascript classes before, I could do:  https://developer.salesforce.com/forums/ForumsMain?id=9060G000000BiGt

Best regards
Alain

All Answers

Raj VakatiRaj Vakati
To access the DevTools, on any web page or app in Google Chrome you can use one of these options: Open the Chrome menu at the top-right of your browser window, then select Tools > Developer Tools. Right-click on any page element and select Inspect Element.

Or Press F12, Ctrl + Shift + I 


https://developers.google.com/web/tools/chrome-devtools/console/
Denise CrosbyDenise Crosby
Thanks Raj,
I can't get it to work. I'm getting 
Uncaught ReferenceError: $A is not defined
    at <anonymous>:1:1
HieuTTHieuTT
You are supposed to go back to Lightning Experience before executing the JavaScript snippet, and the Trailhead doesn't exactly make that clear.

Check out this similar thread: Getting '$A is not defined' error while doing VF Trailhead (https://developer.salesforce.com/forums/?id=9060G0000005MvtQAE)
Alain CabonAlain Cabon
Hi Denise,

This part is badly explained and it is the only time that I had done this with the trailhead modules and because I had taken javascript classes before, I could do:  https://developer.salesforce.com/forums/ForumsMain?id=9060G000000BiGt

Best regards
Alain
This was selected as the best answer
Denise CrosbyDenise Crosby
Thanks a lot Alain, I got this figured out last night from your post. :)