in both firefox and IE the bookmarklet
successfully changes the page background but then immediately redirects to a page reading "url('http://www.colorhexa.com/f9ead3.png')". the code works fine when actually embedded in an html page. obviously, i want to remain on the current page. the two line breaks are there because this site is stupid.
- omLv 67 years agoFavorite Answer
Your bookmarklet doesn't explicitly produce a value, but its implicit value is the value of the last statement in the bookmarklet. Here there's only one statement, and it's an assignment of a string whose value is "url( 'http://www.colorhexa.com/f9ead3.png' )". Therefore that string replaces the page content.
and that should make it work the way you want.