Is this a namespace infront of the colon?

Is this a namespace infront of the colon? I’ve seen this a couple of times. Is this tie to xml in anyway?

ecmascript:void setInterval(function() {scrollBy(0,10)}, 200);

Probably. Javascript doesn’t have namespaces really (we make fake ones), and were once considered in ES4 but removed from the language.

However another EcmaScript language, ActionScript from Adobe, does seem to still use them. Or at least AS3 did. Reference

You will also see something like <a href=“javascript: somescript;”>some bad link</a>. This isn’t a namespace, it just seems to be some kind of URI highjacking: an anchor expects a valid Uniform Resource Identifier, and if you state "javascript: " then I guess it thinks it’s calling a resource called Javascript (whatever is after the colon), and since the browser speaks Javascript, it can run that script.

It is a label not a namespace.

Used like that it is rather pointless to have a label there.

Normally the only use for labels in JavaScript is with the switch/case statements but it can also be used with continue inside of nested loops to indicate which loop to continue at.

Switch example using labels

switch (colour) {
  case 'red':
    code = '#ff0000';
  case 'green':
    code = '#00ff00';
  case 'blue':
    code = '#0000ff';
    code = 'unknown';

Loop example using labels

a: for(i=1; i < 10; i++) {
   b: for(j=10; j > 0; j--) {
      if (i > j) continue a; // exit right out of the b: loop and continue with the next iteration of the a: loop
      if (j === 2) continue b; // exit this iteration of the b loop and start the next
      // more code here for b loop
    // more code here for a loop