Questions tagged [bookmarklet]

A bookmarklet is a browser bookmark for a URL using the 'javascript:' protocol. The 'javascript:' prefix is followed by a snippet of JavaScript code. When invoked, instead of navigating to a new page, the script is executed within the context of the current page.

A bookmarklet is a browser bookmark for a URL using the javascript: protocol. The javascript: prefix is followed by a snippet of JavaScript code. When invoked, instead of navigating to a new page, the script is executed within the context of the current page.

1355 questions
121
votes
9 answers

How to have favicon / icon set when bookmarklet dragged to toolbar?

I've made myself a bookmarklet, and it functions just fine, but when added to a toolbar in Opera or Firefox, it just takes on the default bookmark icon for the browser (a globe and a star, respectively). My site has a favicon, and the window, tab…
Pistos
  • 23,070
  • 14
  • 64
  • 77
82
votes
5 answers

How to remove 'http://' from a URL in JavaScript

I have run into an odd situation. I'm writing a JavaScript bookmarklet that will allow users to click and share external websites to our website very easily and quickly. It simply get's the title, page URL, and if they've selected any text on the…
Peter
  • 3,144
  • 11
  • 37
  • 56
75
votes
5 answers

Load external JS from bookmarklet?

How can I load an external JavaScript file using a bookmarklet? This would overcome the URL length limitations of IE and generally keep things cleaner.
Justin
  • 20,509
  • 6
  • 47
  • 58
59
votes
5 answers

Add a bookmark that is only javascript, not a URL

I'm thinking that the reason I can't do this is because it might be a huge security hole, but here goes... I want to have a bookmark on my browser (FF3, preferably) that is only a snippet of javascript code. It would merely construct a URL based on…
Matt Dawdy
  • 19,247
  • 18
  • 66
  • 91
49
votes
5 answers

JavaScript: Invert color on all elements of a page

Note: I am keeping an up-to-date version of the bookmarklet in my question which works well and is based on Jacob's answer. If you are looking for a bookmarklet to use, use that one. See leosok's fantastic answer if you just want something amazing…
Muhd
  • 24,305
  • 22
  • 61
  • 78
34
votes
3 answers

Adding favicon to javascript Bookmarklet (uses window.open)

I have a bookmarklet that launches a window.open javascript function to open a small window with my bookmarklet -- an external feature used to communicate between any visted site and my server. I'd like for a favicon to show up when the bookmarklet…
Atticus
  • 6,585
  • 10
  • 35
  • 57
33
votes
7 answers

Copy text to clipboard from bookmarklet

I'm trying to write a little bookmarklet that can extract some text from the active page and load that into the clipboard. The extraction is easy enough, but I'm really stuck doing the clipboard-copying part. Currently, I'm just alerting the text…
Ani
  • 111,048
  • 26
  • 262
  • 307
26
votes
3 answers

Bookmarklet to edit current URL

I'm looking for a simple bookmarklet to take the current URL of my website and refresh it with a couple of changes. For example: Take the current page: http://www.example.com/pages/ and change it to: https://admin.example.com/pages/ then load that…
garymc
  • 263
  • 1
  • 3
  • 5
23
votes
3 answers

Firefox Or JavaScript, count the DOM

I'm sure this is simple but I have no idea how to do it. How do i count the amount of DOM elements in my HTML page? I wanted to do this in a userscript or bookmarklet but i have no idea how to start!
user34537
21
votes
1 answer

Content Security Policy for extensions and bookmarklets

Github has the following Content Security Policy: Content-Security-Policy:default-src *; script-src assets-cdn.github.com www.google-analytics.com collector-cdn.github.com; object-src assets-cdn.github.com; style-src 'self' 'unsafe-inline'…
20
votes
4 answers

Bookmarklet wait until Javascript is loaded

I've got a bookmarklet which loads jQuery and some other js libraries. How do I: Wait until the javascript library I'm using is available/loaded. If I try to use the script before it has finished loading, like using the $ function with jQuery…
cgp
  • 41,026
  • 12
  • 101
  • 131
19
votes
2 answers

JavaScript bookmarklet to delete all cookies within a given domain

I am testing a web app that writes cookies to subdomain.thisdomain.com and several subfolders within that. I'm looking for JavaScript that I can put into a bookmarklet that will delete all cookies under that subdomain, regardless of the folder in…
Caveatrob
  • 12,667
  • 32
  • 107
  • 187
18
votes
3 answers

How can I get the element in which highlighted text is in?

I am trying to learn how to write a bookmarklet where I can highlight some text, click on the bookmarklet and have it tell me what got highlighted. I can get that far, but next I want to know what element that text is in. For example:
Koes Bong
  • 1,113
  • 3
  • 15
  • 28
18
votes
3 answers

Running a bookmarklet on an iFrame that is coming from a different domain

Is there any way to run a bookmarklet on an iFrame which is from a different domain? For example, I have a page loaded from http://example.com, which has an iFrame whose source is set to http://example2.com. When I run the bookmarklet, it is always…
Senseful
  • 86,719
  • 67
  • 308
  • 465
1
2 3
90 91