Run Javascript on Web Page

Runs JavaScript on a Safari web page passed as input. Only available when running your shortcut as an Action Extension from Safari.

Score
Stage
Prompt
Type
4
4/5

Information

Parameters

Run JavaScript on [Web Page]
– Script:
var result = [];
// Get all links from the page
var elements = document.querySelectorAll(“a”);
for (let element of elements) {
result.push({
“url”: element.href,
“text”: element.innerText
});
}

// Call completion to finish
completion(result);

Notes

Safari Web Page items are only available when running your shortcut as an Action Extension in Safari.

Input

Safari eb page (Safari web pages)

Result

(Dictionary, Text, Boolean, Number) The output from the JavaScript (JSON)

Details

Score
4/5
Group
Date Added
04/06/2019
Stage
Type
Identifier
is.workflow.actions.runjavascriptonwebpage

Shortcuts Using This


Get more ways to browse the actions – become a member.