<div dir="ltr">More relevant references, this time on the x3d side, and a thought experiment:<br><div><br><a href="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/scripting.html#Scriptlanguages">http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/scripting.html#Scriptlanguages</a> :<br></div><div>MIME type is provided by the server serving the URL.<br><br><a href="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/networking.html#ScriptingLanguageProtocols">http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/networking.html#ScriptingLanguageProtocols</a><br><a href="http://www.web3d.org/documents/specifications/19777-1/V3.3/Part1/concepts.html#SupportedScriptURLs">http://www.web3d.org/documents/specifications/19777-1/V3.3/Part1/concepts.html#SupportedScriptURLs</a><br></div><div>in-line protocol defined by special "ecmascript:" URL protocol definition<br><br></div><div>MIME type for external script is application/ecmascript (not application/x-vrmlscript anymore) : required or recommended ?<br><br></div><div>Question: also explicitly allow additional MIME types: application/x-vrmlscript or/and application/x-x3dscript etc. ?<br></div><div><br><a href="http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/concepts.html#EncapsulatingScriptNodeCode">http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/concepts.html#EncapsulatingScriptNodeCode</a><br></div><div>defines CDATA child construct as additional value for url MFString url field .<br><br><a href="http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/EncodingOfNodes.html#Script">http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/EncodingOfNodes.html#Script</a><br></div><div>encoding<br><br></div><div>Thought experiment for a backward compatible specification:<br><br></div><div>Introduce a 'type' field for the script node:<br></div><div>SFString [in, out] type "application/ecmascript" [MIME type]<br><br></div><div>The type field defines the MIME type for the provided script, similar to the type attribute of the HTML script element. In case an external script is referenced, the MIME type returned by the external resource, if any, takes precedence. In case of an inline script provided with the ecmascript: protocol identifier, the field's value defines the MIME type. It is possible to provide any of the MIME types for script content defined in <a href="http://www.web3d.org/documents/specifications/19777-1/V3.3/Part1/concepts.html#MIMEType">http://www.web3d.org/documents/specifications/19777-1/V3.3/Part1/concepts.html#MIMEType</a> to ensure its recognition. Other values may lead to undefined behaviour, prevent execution of the script.<br></div><div>[Perhaps the following would belong to the XML encoding standard? ] Note that in a HTML environment the script element is typically first interpreted by an HTML browser. It is recommended to use an explicit type field value of 'application/x-vrmlscript' in this case. This value prevents the HTML browser from executing the script but then allows the X3D browser to interprete and execute it using the SAI.<br><br></div><div>Would such a new type field be (largely) backward compatible ? <br><br></div><div>-Andreas<br></div><div><br></div><div><br><br><br></div><div><br><br></div><div><br><br></div><div><br><br></div><div><br></div><div><br><br><br></div><div><br><br><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 22, 2016 at 3:21 PM, Andreas Plesch <span dir="ltr"><<a href="mailto:andreasplesch@gmail.com" target="_blank">andreasplesch@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Here some relevant resources with regards to the script element and its dual use:<br><br><br></div>HTML5 spec. of script element:<br><div><p><a href="https://www.w3.org/TR/html5/scripting-1.html#script" target="_blank">https://www.w3.org/TR/html5/<wbr>scripting-1.html#script</a></p><p><br></p><p>HTML5 spec. of the mime types which must be recognized and executed by web browser <br></p>
<p><a href="https://www.w3.org/TR/html5/scripting-1.html#support-the-scripting-language" target="_blank">https://www.w3.org/TR/html5/<wbr>scripting-1.html#support-the-<wbr>scripting-language</a></p><p></p><p>The same section also specifies a few mime types which must not be executed by the browser. For example, 'application/xml' will never be interpreted and executed by a browser.</p><p><br></p><p><a href="http://www.bitmanagement.com/developer/spec/vrmlscript/vrmlscript.html#Protocol" target="_blank">http://www.bitmanagement.com/<wbr>developer/spec/vrmlscript/<wbr>vrmlscript.html#Protocol</a><br></p>
<p><a href="http://www.bitmanagement.com/developer/spec/vrmlscript/vrmlscript.html#MIMEtype" target="_blank">http://www.bitmanagement.com/<wbr>developer/spec/vrmlscript/<wbr>vrmlscript.html#MIMEtype</a></p>1996 SGI vrmlscript MIME type recommendation.<br></div><div><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 21, 2016 at 11:30 PM, Andreas Plesch <span dir="ltr"><<a href="mailto:andreasplesch@gmail.com" target="_blank">andreasplesch@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr"><a href="https://andreasplesch.github.io/cobweb_dom/tests/x3d_script.xhtml" target="_blank">https://andreasplesch.github.i<wbr>o/cobweb_dom/tests/x3d_script.<wbr>xhtml</a></p>
<p dir="ltr">Since the script tag is already claimed by HTML, there is a conflict with the XML encoding of the x3d script node when x3d nodes are considered page DOM elements.</p>
<p dir="ltr">Nevertheless, in the page above, both types of JavaScripts, 'regular' web page and 'special' x3d, function correctly. The sphere is controlled by a SAI script whereas all other actions are driven by HTML scripts.</p>
<p dir="ltr">This is possible because a HTML script element with a type attribute which is not recognized as an ecmascript related mime type is not executed by the web browser. In the example I used application/x-vrmlscript which at some point was the recommended mime type. But application/SAIscript would also have the desired effect, for example.</p>
<p dir="ltr">Cobweb, on the other hand, is not bothered by the type attribute and proceeds to execute the script as a x3d script.</p>
<p dir="ltr">This solution to allow dual use of the script tag would be understood by web developers because the script tag with special type attributes is used fairly widely to protect data content from being interpreted by the browser in some way.</p>
<p dir="ltr">While this is practical today, what would be required in the standard to allow such a type attribute in the XML encoding of the x3d script node? Since this type attribute would not represent a field, perhaps only the XML encoding standard would be affected?</p><span><font color="#888888">
<p dir="ltr">Andreas </p><span class="HOEnZb"><font color="#888888">
<p dir="ltr">-- <br>
Andreas Plesch<br>
39 Barbara Rd.<br>
Waltham, MA 02453</p>
</font></span></font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br><div data-smartmail="gmail_signature">Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453</div>
</font></span></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453</div>
</div>