Domanda

I am trying to load two different activex objects using the html object tag. the problem is: if the first object tag loads the activex object, then the second should not load. the following html-

<object id='a' classid='......'></object>
<object id='b' classid='......'></object>

This will load both objects. I want to load object 'b' only if object 'a' is not available.

(if none of the object is available, then we should show an IE information bar asking to download the activeX object from a given location). Any solution ? Thank you (User2531191).

È stato utile?

Soluzione

Yes, <object> was designed for exactly this purpose. See W3C reference.
The trick is to nest the "plan B" object inside the main object.

<object id='a' classid='......'>
  <object id='b' classid='......'></object>
</object>

Then it handles b only when a fails for whatever reason. Otherwise, only object a is shown and the content of element a is ignored.
And you can take the nesting deeper if you want, showing object c if neither a nor b works, or finally showing the text if everything else fails.

<object id='a' classid='......'>
  <object id='b' classid='......'>
    <object id='c' classid='......'>
      Sorry, nothing works!
    </object>
  </object>
</object>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top