Neat hack: forcing browsers to refresh script source javascript in your CMS

A handy hack, force browsers of visitors to your website to refresh their javascript cache, handy when you are doing extensive upgrades to your site and you really must ensure everyone is running the latest javascript from your site.

this code works in drupal, but could be easily tweaked for other CMS's or PHP frameworks.

it just appends a "/foo.js?$file_mod_time" to any script sources that are parsed to it, so as soon as you change the file, this ensures any browsers will try to grab the latest version.

function append_js_time($matches) {
  if($matches[1]{0} == '/') {
    $file = ereg_replace("^\/",'',$matches[1]);
    $mtime = filemtime($file);  
    $sep = strstr($matches[1],'?') ? '&' : '?';
    return 'src="'.$matches[1].$sep.$mtime.'"';
  } else {
    return $matches[0];
  }
}

function _phptemplate_variables($hook, $vars) {
	if ($hook == 'page') {
	  $scripts = explode("\n",drupal_get_js());
	  foreach($scripts as $i=> $script) {
           $scripts[$i]=preg_replace_callback('/src="(.*)"/','append_js_time',$script)."\n";
	  }
	  $var['scripts'] = implode($scripts);
        }
}

A browser game is a computer

A browser game is a computer game that is played over the Internet using a web browser. Browser games can be created and run using standard web technologies or browser plug-ins. Browser games include all video game genres and can be single-player or multiplayer. Browser games are also portable and can be played on multiple different devices or web browsers.

Browser games are often free-to-play and do not require client software to be installed apart from a web browser. Multiplayer browser games have an additional focus on social interaction, often on a massive scale. Due to the accessibility of browser games, they are often played in more frequent, shorter sessions compared to traditional computer games.
yeni oyunlar, Mumya Avcısı, Uçan Bebek, Surat Patlatmaca, Stickfighter2, Snoopy,