canRecognizeDocument()

Availability

Dreamweaver MX.

Description

When opening a document (and when more than one server model claims a file extension), Dreamweaver calls this function for each of the extension-associated server models to see whether any of the functions can identify whether the document is its file. If more than one server model claims the file extension, Dreamweaver gives priority to the server model that returns the highest integer.

Arguments

dom

Returns

Dreamweaver expects an integer that indicates the priority that you give to the server model for the file extension. This function should return a value of -1 if the server model does not claim the file extension; otherwise, this function should return a value greater than zero.

Example

In the following example, if the user opens a JavaScript document for the current server model, the sample code returns a value of 2. This value lets the current server model take precedence over the Dreamweaver default server model.

var retVal = -1;
var langRE = /@\s*language\s*=\s*(\"|\')?javascript(\"|\')?/i;
// Search for the string language="javascript"
var oHTML = dom.documentElement.outerHTML;
if (oHTML.search(langRE) > -1)
   retVal = 2;
return retVal;

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/dreamweaver/8/extending/20_serv4.htm