[lp_client_isPrefetch]

Description

Link: [lp_client_isPrefetch]
Author: Bil Corry
Category: Bytes
Version: 8.x
License: Public Domain
Posted: Aug. 24, 2006
Updated: Jan. 01, 0001
More by this author...
Google Web Accelerator and Mozilla browsers can prefetch pages, basically load pages that appear as links on the current page.  This tag looks to see if  the header "x-moz: prefetch" is present, if so, the page is being prefetched by the client browser.

Parameters

none


Sample Usage

if: lp_client_isPrefetch;
  'You are prefetching this content!';
/if;
						

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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[

define_tag: 'lp_client_isPrefetch',
	-description='Returns true if client is doing a prefetch.',
	-priority='replace';

	// looks for header "x-moz: prefetch" currently sent by Google Web Accelerator and Mozilla browsers

	// more info on prefetching:
	//   http://webaccelerator.google.com/webmasterhelp.html
	//   http://www.mozilla.org/projects/netlib/Link_Prefetching_FAQ.html#Do_prefetched_requests_contain_a
	//   http://david.backpackit.com/pub/37983

	if: (string_findregexp: client_headers, -find='x-moz:\\s+.*prefetch', -ignorecase)->size;
		return: true;
	/if;
	return: false;

/define_tag;

]

 

Comments

none

Email:


Password:



Newest

Most Popular

Support tagSwap.net