diff --git a/inc/template.php b/inc/template.php
index b033a82e03ae7b9e5aa7da2676823d45deecf992..4ce5041e9f4463fe54508707eb256a3d2488afab 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -204,8 +204,8 @@ function tpl_metaheaders(){
 
   // include some JavaScript language strings
   ptln('<script language="javascript" type="text/javascript" charset="utf-8">',$it);
-  ptln("  var alertText   = '".$lang['qb_alert']."'",$it);
-  ptln("  var notSavedYet = '".$lang['notsavedyet']."'",$it);
+  ptln("  var alertText   = '".addslashes($lang['qb_alert'])."'",$it);
+  ptln("  var notSavedYet = '".addslashes($lang['notsavedyet'])."'",$it);
   ptln("  var DOKU_BASE   = '".DOKU_BASE."'",$it);
   ptln('</script>',$it);