Skip to content

Instantly share code, notes, and snippets.

@romac
Created December 14, 2010 01:02
Show Gist options
  • Select an option

  • Save romac/739863 to your computer and use it in GitHub Desktop.

Select an option

Save romac/739863 to your computer and use it in GitHub Desktop.
A simple bookmarklet to (re)load a script on a web page.
( function( $, id, src )
{
var $body = $( document.body ),
$script = $( '<script src="' + src + '?_UNIQUE_" id="' + id + '"></script>' ),
$prev = $( '#' + id );
if( $prev.length > 0 )
{
$prev.remove();
}
$script.attr( 'src', $script.attr( 'src' ).replace( '_UNIQUE_', +new Date() ) );
$body.append( $script );
} )( jQuery, 'script-id', 'http://script/location.js' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment