<pre>
```
browser javascript bookmark tricks
JavaScript bookmarks,
also known as "bookmarklets,"
are bookmarks
saved in a web browser
that contain JavaScript code.
They are a handy way to add extra functionality to your browser without needing to install extensions or add-ons. You can use bookmarklets to perform a wide range of tasks, from modifying the appearance of a webpage to extracting information or automating common actions.
Here are some tricks and examples of JavaScript bookmarklets:
Simple Alert: Create a bookmark with the following code to display a simple alert message.
javascript:alert('Hello, World!');
Edit Any Website: Use this bookmarklet to make any webpage content editable. This is useful for taking screenshots or demonstrating something.
javascript:void(document.designMode='on');
Find Broken Links: This bookmarklet checks for broken links on the current page by highlighting them in red.
javascript:(function(){var atags=document.getElementsByTagName('a');for(var i=0;i<atags.length;i++){var xhr=new XMLHttpRequest();(function(atag){xhr.onreadystatechange=function(){if(xhr.readyState==4&&xhr.status!=200){atag.style.color='red';}};xhr.open('HEAD',atag.href,true);xhr.send();})(atags[i]);}})();
Font Increase/Decrease: Increase or decrease the font size on a page. Here's an example to increase:
javascript:document.body.style.fontSize=(parseInt(window.getComputedStyle(document.body).fontSize)+1)+'px';
And to decrease:
javascript:document.body.style.fontSize=(parseInt(window.getComputedStyle(document.body).fontSize)-1)+'px';
Remove Images: Strip all images from the webpage to reduce distractions.
javascript:document.querySelectorAll('img').forEach(img => img.remove());
Color Picker: Get the color of any pixel on the webpage.
javascript:(function(){var e=new EyeDropper;e.open().then(function(t){alert("You picked: "+t.sRGBHex)}).catch(function(e){console.error(e)})})();
Social Media Share: Share the current page on social media. Here's an example for Twitter:
javascript:window.open('https://twitter.com/share?url='+encodeURIComponent(window.location.href));
reload everey 10 seconds
javascript:(function(){ setInterval(function(){ window.location.reload(); }, 10000); })();
To use these bookmarklets,
you can create a new bookmark in your browser
and paste the JavaScript code into the URL section.
When you click on the bookmark,
the JavaScript code will execute on the current page.
Important Note:
Bookmarklets rely on the "javascript:" pseudo-protocol,
which some modern browsers might not support due to security concerns.
Always be cautious about running JavaScript from unknown sources,
as it can pose security risks.
```