Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Bookmarklet
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Example=== This example bookmarklet performs a Wikipedia search on any highlighted text in the web browser window. In normal use, the following JavaScript code would be installed to a bookmark in a browser<ref>Tested on [[Mozilla Firefox]], [[Opera (web browser)|Opera]], [[Safari (web browser)|Safari]], and [[Google Chrome|Chrome]]. Does not work in IE7 or IE8. Original source: [http://math-www.uni-paderborn.de/~axel/bookmarklet.html Alex Boldt]</ref> bookmarks toolbar. From then on, after selecting any text, clicking the bookmarklet performs the search. <syntaxhighlight lang="javascript" line="1"> javascript:(function() { function se(d) { return d.selection ? d.selection.createRange().text : d.getSelection() } var s = se(document); for (var i=0; i<frames.length && (s==null || s==''); i++) s = se(frames[i].document); if (!s || s=='') s = prompt('Enter%20search%20terms%20for%20Wikipedia',''); open('https://en.wikipedia.org' + (s ? '/w/index.php?title=Special:Search&search=' + encodeURIComponent(s) : '')).focus(); })(); </syntaxhighlight> Bookmarklets can modify the [[URL|location]], e.g. to save a [[web page]] to the [[Wayback Machine]], <syntaxhighlight lang="javascript"> javascript:location.href='https://web.archive.org/save/'+document.location.href; </syntaxhighlight> Open a new [[web browser]] window or tab, e.g. to show the source of a web resource if the web browser supports the [[view-source URI scheme]], <syntaxhighlight lang="javascript"> javascript:void(window.open('view-source:'+location)); </syntaxhighlight> Show info related to the current [[URL]], e.g., <syntaxhighlight lang="javascript"> javascript:alert('\tdocument.URL\n'+document.URL+'\n\tdocument.lastModified\n'+document.lastModified+'\n\tlocation\n'+location); </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)