An Interest In:
Web News this Week
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
- March 26, 2024
Run Scripts on websites using this simple technique
What are bookmarklets?
A bookmarklet is a bookmark stored in a web browser that contains JavaScript commands that add new features to the browser.
Developing a bookmarklet is simple and easy to use.
They can even make a post request with the fetch api.
How to develop one
Use javascript in href
attribute of <a>
tags in HTML.
An example would be
<a href="javascript: alert('hello world');">click me</a>
Make that in HTML and drag it into your bookmarks bar, you have just added a bookmarklet to your browser. Isn't it simple?
All the javascript in your bookmarklet has to be minified.
<a href="javascript: fetch('https://api.website.com/endpoint').then((data) => { alert('data'); })"></a>
Bookmarklet can be used to modify(or filter) the content of a website.
Below is an example:
<a href="javascript: document.body.innerHTML = '<h1>yeah!</h1>' })"></a>
Main reason you should consider developing or using a bookmarklet is for productivity.
You can find many pre-built bookmarklets on internet.
I hope this helps someone out there.
Don't forget to mention what you've made in the comments below!
Original Link: https://dev.to/forkbikash/run-scripts-on-websites-using-this-simple-technique-lpn
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To