lundi 14 mai 2012

Balise OBJECT (tag)

http://joliclic.free.fr/html/object-tag/index.php

Incorporer un document HTML
<object data="data/test.html" type="text/html" width="300" height="200">
  alt : <a href="data/test.html">test.html</a>
</object>
incorporer un document pdf
<object data="data/test.pdf" type="application/pdf" width="300" height="200">
  alt : <a href="data/test.pdf">test.pdf</a>
</object>

Vous pouver spécifier des paramètres relatifs au document par l'intermédiaire de la balise param. IE a parfois besoin du paramètre src pour localiser correctement la source.

incorporer un document wav
<object type="audio/x-wav" data="data/test.wav" width="200" height="20">
  <param name="src" value="data/test.wav">
  <param name="autoplay" value="false">
  <param name="autoStart" value="0">
  alt : <a href="data/test.wav">test.wav</a>
</object>
Le paramètre autoplay est compréhensible par QuickTime, autoStart par Windows Media Player et Real Audio.


Pour certains types, comme les documents QuickTime, IE a besoin d'une valeur non standard pour l'attribut standard classid, un identifiant pour charger un activeX associé.

insertion d'un document QuickTime uniquement pour IE
<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
        width="320" height="240">
  <param name="src" value="data/test.mov" >
  alt : <a href="data/test.mov">test.mov</a>
</object>

Note: Les Objects ont un gros défaut par rapport aux Iframes, c'est que certains navigateurs affichent, même quand il n'y en a pas besoin, des "scrollbars"
D'après ce que j'ai compris, il faut ajouter à la feuille de style CSS:


body {
overflow:auto;
}


J'ai vu qu'on devait ajouter ce code à la page qui s'affiche dans l'object. C'est évidemment impossible quand il s'agit d'une page sur laquelle vous n'avez aucun contrôle. Mais je ne suis pas sûr de cela.

Par ailleurs, et c'est une bonne nouvelle, les iframes seraient maintenant à nouveau acceptés en HTML5.
Voir aussi: http://bernard.quevillier.pagesperso-orange.fr/toposnew/object.htm

Aucun commentaire:

Enregistrer un commentaire