forward
Category: Browser Control
Namespace: web.browser.forward
Description
Navigate forward to the next page in browser history. This is equivalent to clicking the browser forward button.
Syntax
await web.browser.forward();
Parameters
None
Returns
Promise<boolean> - Returns true when operation completes
Example
Simple example
await web.browser.forward();
Practical example
document.getElementById('forward-btn').addEventListener('click', async () => {
const canGoForward = await web.browser.canGoForward();
if (canGoForward) {
await web.browser.forward();
}
});
Advanced example
async function navigateForward() {
const canGoForward = await web.browser.canGoForward();
if (canGoForward) {
await web.browser.forward();
const url = await web.browser.getCurrentUrl();
console.log('Navigated forward to:', url);
} else {
console.log('Cannot go forward - at end of history');
}
}
Use Cases
- Implement forward button in custom navigation
- Navigate to next page in history
- Redo navigation actions
- Browser-like forward functionality
- Navigate through history
- Return to newer content
- Implement keyboard shortcuts (Alt+Right)
- Custom navigation controls
Related Methods
web.browser.back()web.browser.canGoForward()web.browser.navigate()
Notes
- Part of browser control functionality
- Asynchronous operation
- Returns promise