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
Type
InterActivity
Expertise
4/5
Type
InterActivity
Expertise

Action 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)

Shortcuts Using This

Details

Type
Interactivity
Expertise Needed
Matthew's Score
4/5
Category
Date Added to Shortcuts
04/06/2019
Identifier
is.workflow.actions.runjavascriptonwebpage