IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

Empêcher le copier coller d'une page web


Sujet :

JavaScript

  1. #1
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2015
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : Cameroun

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Novembre 2015
    Messages : 25
    Points : 15
    Points
    15
    Par défaut Empêcher le copier coller d'une page web
    Bonsoir a tous,
    j'ai un fichier html et j'aimerais pouvoir copier-coller le texte mais j'arrive pas.
    Je pense que le code qui permet d'empecher l'option copier coller se trouve dans le code javascript suivant:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    //<!--
    //v1.7
    // Flash Player Version Detection
    // Detect Client Browser type
    // Copyright 2005-2008 Adobe Systems Incorporated.  All rights reserved.
    var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
    var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
    var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
    function ControlVersion()
    {
    	var version;
    	var axo;
    	var e;
    	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
    	try {
    		// version will be set for 7.X or greater players
    		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
    		version = axo.GetVariable("$version");
    	} catch (e) {
    	}
    	if (!version)
    	{
    		try {
    			// version will be set for 6.X players only
    			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
     
    			// installed player is some revision of 6.0
    			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
    			// so we have to be careful. 
     
    			// default to the first public version
    			version = "WIN 6,0,21,0";
    			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
    			axo.AllowScriptAccess = "always";
    			// safe to call for 6.0r47 or greater
    			version = axo.GetVariable("$version");
    		} catch (e) {
    		}
    	}
    	if (!version)
    	{
    		try {
    			// version will be set for 4.X or 5.X player
    			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
    			version = axo.GetVariable("$version");
    		} catch (e) {
    		}
    	}
    	if (!version)
    	{
    		try {
    			// version will be set for 3.X player
    			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
    			version = "WIN 3,0,18,0";
    		} catch (e) {
    		}
    	}
    	if (!version)
    	{
    		try {
    			// version will be set for 2.X player
    			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
    			version = "WIN 2,0,0,11";
    		} catch (e) {
    			version = -1;
    		}
    	}
     
    	return version;
    }
    // JavaScript helper required to detect Flash Player PlugIn version information
    function GetSwfVer(){
    	// NS/Opera version >= 3 check for Flash plugin in plugin array
    	var flashVer = -1;
     
    	if (navigator.plugins != null && navigator.plugins.length > 0) {
    		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
    			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
    			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
    			var descArray = flashDescription.split(" ");
    			var tempArrayMajor = descArray[2].split(".");			
    			var versionMajor = tempArrayMajor[0];
    			var versionMinor = tempArrayMajor[1];
    			var versionRevision = descArray[3];
    			if (versionRevision == "") {
    				versionRevision = descArray[4];
    			}
    			if (versionRevision[0] == "d") {
    				versionRevision = versionRevision.substring(1);
    			} else if (versionRevision[0] == "r") {
    				versionRevision = versionRevision.substring(1);
    				if (versionRevision.indexOf("d") > 0) {
    					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
    				}
    			}
    			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
    		}
    	}
    	// MSN/WebTV 2.6 supports Flash 4
    	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
    	// WebTV 2.5 supports Flash 3
    	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
    	// older WebTV supports Flash 2
    	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
    	else if ( isIE && isWin && !isOpera ) {
    		flashVer = ControlVersion();
    	}	
    	return flashVer;
    }
    // When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
    function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
    {
    	versionStr = GetSwfVer();
    	if (versionStr == -1 ) {
    		return false;
    	} else if (versionStr != 0) {
    		if(isIE && isWin && !isOpera) {
    			// Given "WIN 2,0,0,11"
    			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
    			tempString        = tempArray[1];			// "2,0,0,11"
    			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
    		} else {
    			versionArray      = versionStr.split(".");
    		}
    		var versionMajor      = versionArray[0];
    		var versionMinor      = versionArray[1];
    		var versionRevision   = versionArray[2];
            	// is the major.revision >= requested major.revision AND the minor version >= requested minor
    		if (versionMajor > parseFloat(reqMajorVer)) {
    			return true;
    		} else if (versionMajor == parseFloat(reqMajorVer)) {
    			if (versionMinor > parseFloat(reqMinorVer))
    				return true;
    			else if (versionMinor == parseFloat(reqMinorVer)) {
    				if (versionRevision >= parseFloat(reqRevision))
    					return true;
    			}
    		}
    		return false;
    	}
    }
    function AC_AddExtension(src, ext)
    {
      if (src.indexOf('?') != -1)
        return src.replace(/\?/, ext+'?'); 
      else
        return src + ext;
    }
    function AC_Generateobj(objAttrs, params, embedAttrs) 
    { 
      var str = '';
      if (isIE && isWin && !isOpera)
      {
        str += '<object ';
        for (var i in objAttrs)
        {
          str += i + '="' + objAttrs[i] + '" ';
        }
        str += '>';
        for (var i in params)
        {
          str += '<param name="' + i + '" value="' + params[i] + '" /> ';
        }
        str += '</object>';
      }
      else
      {
        str += '<embed ';
        for (var i in embedAttrs)
        {
          str += i + '="' + embedAttrs[i] + '" ';
        }
        str += '> </embed>';
      }
      document.write(str);
    }
    function AC_FL_RunContent(){
      var ret = 
        AC_GetArgs
        (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
         , "application/x-shockwave-flash"
        );
      AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
    }
    function AC_SW_RunContent(){
      var ret = 
        AC_GetArgs
        (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
         , null
        );
      AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
    }
    function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
      var ret = new Object();
      ret.embedAttrs = new Object();
      ret.params = new Object();
      ret.objAttrs = new Object();
      for (var i=0; i < args.length; i=i+2){
        var currArg = args[i].toLowerCase();    
        switch (currArg){	
          case "classid":
            break;
          case "pluginspage":
            ret.embedAttrs[args[i]] = args[i+1];
            break;
          case "src":
          case "movie":	
            args[i+1] = AC_AddExtension(args[i+1], ext);
            ret.embedAttrs["src"] = args[i+1];
            ret.params[srcParamName] = args[i+1];
            break;
          case "onafterupdate":
          case "onbeforeupdate":
          case "onblur":
          case "oncellchange":
          case "onclick":
          case "ondblclick":
          case "ondrag":
          case "ondragend":
          case "ondragenter":
          case "ondragleave":
          case "ondragover":
          case "ondrop":
          case "onfinish":
          case "onfocus":
          case "onhelp":
          case "onmousedown":
          case "onmouseup":
          case "onmouseover":
          case "onmousemove":
          case "onmouseout":
          case "onkeypress":
          case "onkeydown":
          case "onkeyup":
          case "onload":
          case "onlosecapture":
          case "onpropertychange":
          case "onreadystatechange":
          case "onrowsdelete":
          case "onrowenter":
          case "onrowexit":
          case "onrowsinserted":
          case "onstart":
          case "onscroll":
          case "onbeforeeditfocus":
          case "onactivate":
          case "onbeforedeactivate":
          case "ondeactivate":
          case "type":
          case "codebase":
          case "id":
            ret.objAttrs[args[i]] = args[i+1];
            break;
          case "width":
          case "height":
          case "align":
          case "vspace": 
          case "hspace":
          case "class":
          case "title":
          case "accesskey":
          case "name":
          case "tabindex":
            ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
            break;
          default:
            ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
        }
      }
      ret.objAttrs["classid"] = classid;
      if (mimeType) ret.embedAttrs["type"] = mimeType;
      return ret;
    }
    // -->
    SVP pouvez vous m'aider à trouver la ligne dans le code ci-dessus qui permet d'empecher l'option copier coller de ma page web??
    Merci d'avance

  2. #2
    Membre confirmé Avatar de 01001111
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2009
    Messages
    319
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Loire (Auvergne)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Janvier 2009
    Messages : 319
    Points : 509
    Points
    509
    Par défaut
    Alors, non il n'y a rien ici qui empêche le copier/coller du moins en javascript
    mais peut-être est-il interdit dans le fichier swf?

    attention flash est en voie d'obsolescence depuis un bon moment, il serait temps de ne plus l'utiliser.

  3. #3
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2015
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : Cameroun

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Novembre 2015
    Messages : 25
    Points : 15
    Points
    15
    Par défaut
    OOK merci,
    Mais j'arrive pas à ouvrir ce fichier swf avec notepad++.

  4. #4
    Membre confirmé Avatar de 01001111
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2009
    Messages
    319
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Loire (Auvergne)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Janvier 2009
    Messages : 319
    Points : 509
    Points
    509
    Par défaut
    normal, swf est un format propriétaire et compilé!
    il te faut la source en .fla + éventuellement des fichiers .as, plus flash pro pour l'ouvrir et agir dessus.

  5. #5
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2015
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : Cameroun

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Novembre 2015
    Messages : 25
    Points : 15
    Points
    15
    Par défaut
    Vaincu!!!
    Ok je vois
    Merci pour ton intervention

  6. #6
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 640
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 640
    Points : 66 666
    Points
    66 666
    Billets dans le blog
    1
    Par défaut
    Si c'est juste copier le texte de la page ... un screenshot et un bon OCR ...

  7. #7
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2015
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : Cameroun

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Novembre 2015
    Messages : 25
    Points : 15
    Points
    15
    Par défaut
    Comment ca se fait??
    Peux tu me donner un lien qui m'explique comment faire? ou bien??

  8. #8
    Membre confirmé Avatar de 01001111
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2009
    Messages
    319
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Loire (Auvergne)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Janvier 2009
    Messages : 319
    Points : 509
    Points
    509
    Par défaut
    si tu as un linux sous la main, essaie tesseract
    https://sourceforge.net/projects/tes...?source=navbar

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Faire un Coller sur une page Web
    Par Cjvg2 dans le forum VB 6 et antérieur
    Réponses: 0
    Dernier message: 28/09/2013, 18h11
  2. [XL-2007] Copier/coller d une page a une autre dont le nom est variable
    Par alexandrek dans le forum Macros et VBA Excel
    Réponses: 1
    Dernier message: 23/01/2011, 14h22
  3. Réponses: 1
    Dernier message: 08/11/2009, 19h52
  4. Empêcher le raffréchissement total d'une page Web?
    Par Paul Van Walleghem dans le forum ASP.NET
    Réponses: 7
    Dernier message: 23/03/2008, 12h23
  5. comment empêcher le copier/coller dans une zone de texte
    Par hanafimohammed dans le forum Balisage (X)HTML et validation W3C
    Réponses: 1
    Dernier message: 22/05/2007, 20h57

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo