Lasso Soft Inc. > Home


AuthorBil Corry
LicensePublic Domain
Posted03 Dec 2007
Updated03 Dec 2007
More by this author...


This tag will return true when the header "X-Requested-With: XMLHttpRequest" is found.  The header is added by jQuery, Prototype and possibly other JavaScript libraries.  Note that this header is easily spoofed.

Sample Usage

lp_client_isAJAX; // that's it!

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.


define_tag: 'lp_client_isAJAX',
	-description='Returns true if client is an AJAX (XHR) request.',

	// looks for header "X-Requested-With: XMLHttpRequest" added by jQuery and Prototype (and others?)
	// note, can be easily spoofed!

	if: (string_findregexp: client_headers, -find='X-Requested-With:\\s+XMLHttpRequest', -ignorecase)->size;
		return: true;
	return: false;




No comments

Please log in to comment

LassoSoft Inc. > Home



©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft