Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > fr.comp.lang.javascript > #2927

Échappement html et javascript

Path csiph.com!aioe.org!talisker.lacave.net!lacave.net!news.trigofacile.com!.POSTED.reverse-90.fdn.fr!not-for-mail
From Yliur <yliur@free.fr>
Newsgroups fr.comp.lang.javascript
Subject Échappement html et javascript
Date Tue, 7 Jul 2015 09:05:22 +0200
Organization Groupes francophones par TrigoFACILE
Message-ID <20150707090522.2929985c@free.fr> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Injection-Info news.trigofacile.com; posting-account="yliur@free.fr"; posting-host="reverse-90.fdn.fr:80.67.176.90"; logging-data="29310"; mail-complaints-to="abuse@trigofacile.com"
X-Newsreader Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-unknown-linux-gnu)
Xref aioe.org fr.comp.lang.javascript:2927

Show key headers only | View raw


Bonjour

Je tâchais de soigneusement appliquer l'échappement javascript puis
html dans les pages que je génère (avec un programme).

Et en fait ça n'a pas l'air tout à fait correct : j'ai l'impression que
dans la balise <script> il ne faut pas faire les échappements html.
Après être tombé dessus par hasard j'ai fait un essai sur une page toute
simple et on dirait bien que les échappements html sont en trop dans
une balise <script>. par exemple cette page m'affiche une boîte de
dialogue avec "&amp;" écrit dedans au démarrage mais une boîte avec
"&" quand je clique sur le champ de saisie :

<html>
  <head>
  </head>
  <body>
    <input type="text" onClick="javascript:alert ('&amp;') ;" />
    <script>
      alert ('&amp;') ;
    </script>
  </body>
</html>

A priori dans mes pages ça fonctionne comme ça : dans le code html à
proprement parler (par exemple le code d'un événement sur un champ de
saisie) je dois appliquer les échappements js puis html, mais dans la
balise <script> seulement les échappements js. Testé avec Firefox
seulement.

Est-ce que quelqu'un peut confirmer/infirmer ça ? C'est normal, c'est
écrit dans une norme quelque part ?

Merci

Yliur

Back to fr.comp.lang.javascript | Previous | NextNext in thread | Find similar


Thread

Échappement html et javascript Yliur <yliur@free.fr> - 2015-07-07 09:05 +0200
  Re: Échappement html et javascript Paul Gaborit <Paul.Gaborit@invalid.invalid> - 2015-07-07 11:26 +0200
    Re: Échappement html et javascript Yliur <yliur@free.fr> - 2015-07-08 00:55 +0200

csiph-web