W3C home > Mailing lists > Public > public-web-plugins@w3.org > October 2003

Working around plugin prompt in IE6SP1b cleanly (ish)

From: Andrew Clover <and-w3@doxdesk.com>
Date: Wed, 8 Oct 2003 14:44:18 +0000
To: public-web-plugins@w3.org
Message-ID: <20031008144418.GA15142@doxdesk.com>

It is possible to work around the plugin prompt in the new IE6 update in
a standards-compliant and backwards compatible way. I've been looking at
this trick as a means of hacking IE into supporting standards-compliant
Java and Flash objects, but for now here's the version that just works
around the immediate problem.

This approach:

  - doesn't affect non-IE/Win browsers at all;
  - removes the pointless prompt box if JavaScript is enabled in IE6SP1b;
  - still works (but with the pointless prompt box) if JS is disabled;
  - relies on an old and obscure IE XML feature.

To use this, each plugin should be surrounded by the following:

  <script type="text/javascript"> plug_begin(); </script>
    ...
  <script type="text/javascript">//<![CDATA[]]></script>
  <script type="text/javascript"> plug_end(); </script>

'...' is your <object> or <applet> tag, whatever you usually use to
embed in IE. Take care to insert the second script element's contents
exactly.

Then insert into the document's <head>:

  <script type="text/javascript" src="plug.js"></script>

plug.js consists of:

  // plug.js 0.1 - use freely - and@doxdesk.com
  function plug_begin() {}
  function plug_end() {}
  /*@cc_on
  @if (@_win32 && @_jscript_version>=5)
  var plug_BEGIN= '\x3C![CDATA[';
  var plug_END= '\x3Cscript type="text/javascript"\x3E//\x3C![CDATA[]]\x3E';
  function plug_begin() {
    document.write('\x3Cscript type="text/xml" id="plug_xml"\x3E'+plug_BEGIN);
  }
  function plug_end() {
    var c= plug_xml.innerHTML;
    var ix0= c.indexOf(plug_BEGIN);
    var ix1= c.lastIndexOf(plug_END);
    if (ix0!=-1 && ix1!=-1) c= c.substring(ix0+plug_BEGIN.length, ix1);
    else c= 'plug.js: end of block not recognised';
    document.write(c);
    plug_xml.parentNode.removeChild(plug_xml);
  }
  @end @*/

This can be included as an embedded script inside the head instead of
linking, if you prefer.

Working out what, exactly, this does and why is left as an exercise to the
more masochistic breed of reader.

-- 
Andrew Clover
mailto:and@doxdesk.com
http://www.doxdesk.com/
Received on Wednesday, 8 October 2003 11:01:04 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 19:56:03 UTC