5

Today I found this code snippet:

<object ID="FF" CLASSID="clsid:guid" CODEBASE="url" VIEWASTEXT></object>
<object ID="FileSaver" CLASSID="clsid:guid" CODEBASE="url" VIEWASTEXT></object>
…
<script language="javascript">
    function FileSaver::OnFinished(Status){…}
    function FF::OnFinished(Status){…}
</script>

I can't find anything relevant to explain this syntax. Is it really javascript? Is it correct? If not, how the code should look like?

This is a single page without external script links. Note that function declarations are directly inside <script> block.

13xforever
  • 461
  • 6
  • 15
  • And just like that, SO borked the code snippet. Not cool. – 13xforever May 31 '11 at 10:00
  • after pasting in the code, select it all, and hit the `{}` button in the editor toolbar. Viola! The [language hint](http://meta.stackexchange.com/questions/981/syntax-highlighting-language-hints/75019#75019) isn't necessary, but sometimes helps. – sarnold May 31 '11 at 10:11
  • 1
    possible duplicate of [What does ‘::’ (double colon) do in javascript for events?](http://stackoverflow.com/questions/5715239/what-does-double-colon-do-in-javascript-for-events) – outis May 31 '11 at 10:12
  • @sarnold I did! And the preview was fine. – 13xforever May 31 '11 at 10:17
  • @13x, ah, I see, so you did -- but you needed a blank line after the `` hint. (It took me longer than I care to admit to discover that the blank line was mandatory. :) – sarnold May 31 '11 at 10:20
  • 3
    @13xforever: Might I suggest you post the answer as an actual answer to your own question? That's perfectly acceptable :-) – James Wiseman May 31 '11 at 10:29
  • @James Wiseman: Yeah, I tried it the last time, but couldn't (there was a time limit restriction). – 13xforever Jun 09 '11 at 10:41

1 Answers1

4

Thanks for everyone who looked into this.

Anyway, just as one could expect, not after five minutes after submitting the question, I found How to handle an ActiveX event in Javascript question about ActiveX callback handlers in IE, so it answers the main part of the question. As well, as the question that @outis has linked.

But I can't find any documentation on MSDN and that's troubling.

Conclusion: this is IE-specific ECMAScript extension for event handler declaration.

Community
  • 1
  • 1
13xforever
  • 461
  • 6
  • 15
  • There is [this article](https://msdn.microsoft.com/en-us/library/ms974564.aspx) on MSDN. Also, I've written a [library](https://github.com/zspitz/activex-js-events) to work the many limitations of these event handlers. – Zev Spitz Feb 01 '17 at 22:20