I need a bookmarklet that extracts the content of certain HTML elements. This content should then be included in an external URL’s query component, which the bookmarklet either redirects to or displays as hyperlink.
- It must access the DOM of the currently loaded web page. No additional HTTP requests.
- It must find the elements with XPath.
I doubt that there exists a bookmarklet that does both parts, so a script that can serve as good starting point would be fine, too.
Example
The page:
Name: John Doe
Languages: English, Spanish
Description: John Doe is …
The generated URL:
https://example.com/extracted-content?v1=John%20Doe&v2=English,Spanish&v3=John%20Doe%20is%20%E2%80%A6