Skip to content

Instantly share code, notes, and snippets.

@theAJFM
Last active October 25, 2023 19:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theAJFM/c15535c0b7a994b126f41e127466d48a to your computer and use it in GitHub Desktop.
Save theAJFM/c15535c0b7a994b126f41e127466d48a to your computer and use it in GitHub Desktop.
A useful bookmarklet to submit a page content along with input for tags to a webhook / endpoint
javascript:(function()
{
var tags = prompt("Enter relevant tags for the article:","");
var form = document.createElement('form');
form.style.visibility = 'hidden';
form.method = 'post';
form.action = '<link to your webhook>';
form.target = 'response';
inputTitle = document.createElement('input');
inputTitle.name = 'title';
inputTitle.value = document.title;
form.appendChild(inputTitle);
inputTags = document.createElement('input');
inputTags.name = 'tags';
inputTags.value = tags;
form.appendChild(inputTags);
inputUrl = document.createElement('input');
inputUrl.name = 'url';
inputUrl.value = window.location.href;
form.appendChild(inputUrl);
dataTitle = document.createElement('input');
dataTitle.name = 'data';
dataTitle.value = document.querySelector('*').outerHTML;
form.appendChild(dataTitle);
document.body.appendChild(form);
form.submit();
}
)();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment