Run Javascript on Web Page

shortcuts-action-icon-run-javascript-on-web-page.webp

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

Input

Safari eb page (Safari web pages)

Result

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

Details

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

Notes

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

No results found.

Shortcuts Using This

No results found.