Plain JavaScript implementation :
-
Include the
window-message.js
file within your source code.<script type="text/javascript" src="window-message.js"></script>
-
Send messages to the window simply by calling the function:
message('your message goes here');
Usage Examples :
-
'Hello World' Message
message('Hello World!');
-
Arbitrary Message
var val = document.querySelector('#input-test-02').value; val = (val == '') ? 'no input message!!' : val; message(val);
-
Multiple Messaging
var n = []; for ( var i in navigator ) { n.push(i +' : '+ navigator[i]); } function nn(i) { message(n[i]); if ( i < n.length-1 ) { setTimeout(function(){ nn(i+1) }, 200); } } nn(0);