PageReference can be used to navigate from the current page to a different page using Salesforce Apex.
The below code is used to open new page ‘AddAllBlog’ from current page.
Apex Code:
public PageReference skip() {
PageReference pg = new PageReference('/apex/AddAllBlog');
pg.setRedirect(true);
return pg;
}
If you give URL as ‘http://google.com’ instead of ‘/apex/AddAllBlog’, it will open google website.