Saturday, October 11, 2008

Javascript - Know how v1.0?

To know the protocol your current window is using:


What just happened is I had this little snippet below the "Click Here - Protocol" Button.
alert(window.location.protocol);

To know who is hosting my blog:


The executing code under "Click Here - Hostname" button is.
alert(window.location.hostname);

Application :- When we open an AJAX call from within CRM, we can generate the URL like this:
{
var Protocol = window.location.protocol;
var HostName = window.location.hostname;
var sURL = Protocol+'//'+HostName+'/webservice.asmx';
}

at runtime and pass it this way:
xmlHttp.Open('POST',sURL,true);

A useful piece of information I use it often now.

No comments:

Post a Comment