<p>I'm thinking that the reason I can't do this is because it might be a huge security hole, but here goes...</p>

<p>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 the current date and then do a window.location = on that URL.</p>

<p>I know that I could make a page and keep it on my local machine and just refer to it that way, but I was just wondering if you could bypass that step and actually have the "location" of the bookmark really just be javascript.  I could have sworn that this was possible years ago, but I can't find anything that tells me either way now.</p>

[{'answer_id': 9105, 'author': 'Pat', 'author_id': 238, 'author_profile': 'https://Stackoverflow.com/users/238', 'pm_score': 7, 'selected': True, 'text': '<p>What you want is a <a href="http://en.wikipedia.org/wiki/Bookmarklet" rel="noreferrer">bookmarklet</a> they are easy to create and should work in most major browsers.</p>\n\n<p>Edit: Stack overflow seems not to allow creating bookmarklets in the context of the site, basically you can create a new bookmark and type the following in the location field</p>\n\n<pre>javascript:window.location=\'http://www.google.com/search?q=\'+Date()</pre>\n\n<p>to get a bookmarklet that searches google for the current date.</p>\n'}, {'answer_id': 9109, 'author': 'Dillie-O', 'author_id': 71, 'author_profile': 'https://Stackoverflow.com/users/71', 'pm_score': 3, 'selected': False, 'text': "<p>Well, I just created a bookmark in FF3, went back and updated it and added the following test:</p>\n\n<pre><code>javascript:alert('Wacky%20test%20yo');\n</code></pre>\n\n<p>Low and behold, after I saved and loaded, I was able to get my alert.</p>\n\n<p>I'm sure you can work up something similar for your needs.</p>\n"}, {'answer_id': 68718, 'author': 'scunliffe', 'author_id': 6144, 'author_profile': 'https://Stackoverflow.com/users/6144', 'pm_score': 4, 'selected': False, 'text': '<p>One minor catch. <strong>IE</strong> can only handle a <strong>508</strong> character URL in this format.  If you save it in IE with a url longer than this, it will truncate without warning and thus fail.</p>\n\n<p>If you need a really complex script, you\'ll need to use a "hosted" bookmarklet, where you have a short bookmark that injects a script tag into the page, to "call" your hosted bookmarklet.</p>\n\n<p>It isn\'t as nice/portable, but its the only workaround.</p>\n'}, {'answer_id': 476592, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 3, 'selected': False, 'text': '<p>Google Bookmark</p>\n\n<pre><code>javascript:(function(){var%20a=window,b=document,c=encodeURIComponent,d=a.open("http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk="+c(b.location)+"&amp;title="+c(b.title),"bkmk_popup","left="+((a.screenX||a.screenLeft)+10)+",top="+((a.screenY||a.screenTop)+10)+",height=420px,width=550px,resizable=1,alwaysRaised=1");a.setTimeout(function(){d.focus()},300)})();\n</code></pre>\n'}, {'answer_id': 6764379, 'author': 'Joseph Marikle', 'author_id': 854246, 'author_profile': 'https://Stackoverflow.com/users/854246', 'pm_score': 5, 'selected': False, 'text': '<p>It is worthy of note that you can put that in a function wrapper as well.  imranamajeed nicely illustrated that for us... but apparently I\'m too new to the site to up his post. :P</p>\n\n<p>so for clarity:</p>\n\n<pre><code>javascript:(function(){\n  location.href = location.href + "#";\n})();\n</code></pre>\n\n<p>(the carriage returns did not affect performance in chrome and IE)</p>\n'}]
['https://Stackoverflow.com/questions/9104', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/232/']