-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
355 lines (337 loc) · 11.7 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
<html>
<head>
<title>TextGlass</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="img/textglass_icon_small.png?1" rel="shortcut icon"/>
<style type="text/css">
body,
html {
margin: 0;
padding: 0;
border: 0;
font-family: Helvetica, Arial, sans-serif;
background-color: #FFFFFF;
}
a {
cursor: pointer;
text-decoration: underline;
}
img {
max-width: 100%;
}
.canvas {
padding: 30px;
}
.logo {
width: 300px;
padding-top: 10px;
padding-bottom: 10px;
}
.content {
padding-left: 43px;
}
.sub {
padding-left: 20px;
}
.out {
color: #0000FF;
font-family: "Courier New", Courier, monospace;
padding-left: 20px;
}
.err {
color: #FF0000;
font-family: "Courier New", Courier, monospace;
padding-left: 20px;
}
.input {
width: 100%;
max-width: 500px;
}
p {
padding-right: 10px;
line-height: 130%;
}
.max {
max-width: 500px;
}
a:link {
cursor: pointer;
text-decoration: underline;
color: #008FB4;
}
a:visited {
color: #C91E50;
}
ul {
padding-left: 25px;
}
h3 {
padding-top: 20px;
}
.copyright {
font-style: italic;
font-size: smaller;
}
@media (max-width: 500px) {
.canvas {
padding: 15px;
}
.logo {
max-width: 200px;
padding-top: 10px;
padding-bottom: 10px;
}
.content {
padding-left: 27px;
}
ul {
padding-left: 10px;
}
}
</style>
</head>
<body>
<div class="canvas">
<div class="logo">
<img src="img/textglass_small.png" alt="TextGlass">
</div>
<div class="content">
<h3>
WHAT IS TEXTGLASS?
</h3>
<p class="max">
TextGlass is a text classification project. This encompasses things
like device, browser, OS detection, and even WAF rules. Give TextGlass a
string (like a HTTP User-Agent request header) and it will tell you what it is.
</p>
<p class="max">
TextGlass has extended the idea of classification into generic JSON
domains. The domain tells the TextGlass client how to classify the input
into a result. This will allow this project and 3rd parties to create their
own domains and use them with standard TextGlass clients. This also allows
you to a run a domain across a large variety of languages and platforms
and achieve identical results.
</p>
<p class="max">
TextGlass has client support for the following languages:
</p>
<p class="max sub">
Javascript, C, and Java
</p>
<p class="max">
TextGlass supports the following platforms:
</p>
<p class="max sub">
Varnish Cache
</p>
<p class="max">
We are looking to expand our language and platform offering, so reach out if you would
like to help.
</p>
<p class="max">
TextGlass provides the following domains:
</p>
<p class="max sub">
Device, Browser, and OS
</p>
<p class="max">
For more information, please scroll down to the FAQ section.
</p>
<h3>
WHY TEXTGLASS?
</h3>
<p class="max">
Too many flawed browser, OS, and device detection algorithms.
Most are a jumble of regex and if statements. Also, the quality, accuracy, and
consistency can vary greatly between languages and implementations. TextGlass
is an attempt at a better detection library. Code and pattern data are cleanly
seperated and a specification exists so that results are identical regardless
of language or platform. Also, the pattern rules allow for any unique text to
be identified with a simple definition.
</p>
<h3>
DEMO
</h3>
<p id="demotext" class="max">Loading...</p>
<p>
<a href="http://codepen.io/TextGlass/pen/WrbeaK?editors=101">CodePen example</a>
</p>
<h3>
LINKS
</h3>
<a href="https://github.com/TextGlass">Github project home</a><br>
<a href="https://github.com/TextGlass/reference/wiki/Domain-Specification">Domain specification</a><br>
<a href="performance/">Performance</a><br>
<a href="releases/">Releases</a><br>
<a href="mailto:project@textglass.org">Contact</a><br>
<br>
<b>DOWNLOAD:</b><br>
<a href="https://github.com/TextGlass/reference/archive/master.zip">Download TextGlass</a><br>
<br>
<b>DOMAINS:</b><br>
<a href="https://github.com/TextGlass/device">Device domain</a>
[<a href="https://github.com/TextGlass/device/archive/master.zip">Download</a>]<br>
<a href="https://github.com/TextGlass/browser">Browser domain</a>
[<a href="https://github.com/TextGlass/browser/archive/master.zip">Download</a>]<br>
<a href="https://github.com/TextGlass/os">OS domain</a>
[<a href="https://github.com/TextGlass/os/archive/master.zip">Download</a>]<br>
<br>
<b>CLIENTS:</b><br>
<a href="https://github.com/TextGlass/reference">Reference client</a>
[<a href="https://github.com/TextGlass/reference/archive/master.zip">Download</a>]<br>
<a href="https://github.com/TextGlass/c">C client</a>
[<a href="https://github.com/TextGlass/c/archive/master.zip">Download</a>]<br>
<a href="https://github.com/TextGlass/javascript">Javascript client</a>
[<a href="trunk/javascript">Demo</a>]
[<a href="https://github.com/TextGlass/javascript/archive/master.zip">Download</a>]<br>
<a href="https://github.com/TextGlass/java">Java client</a>
[<a href="https://github.com/TextGlass/java/archive/master.zip">Download</a>]<br>
<br>
<b>PLATFORMS:</b><br>
<a href="https://github.com/TextGlass/varnish">Varnish Cache</a><br>
<br>
<b>LICENSE:</b><br>
<a href="https://www.apache.org/licenses/LICENSE-2.0">Apache License 2.0</a><br>
<h3>
FAQ
</h3>
<ul>
<li>
<p class="max">
<b>How do you do mobile detection with TextGlass?</b>
<br><br>
Classify an HTTP User-Agent string against the Browser and OS domains.
Check if the "mobile" attribute is set to "true" on either domain.
This method relies on the Browser and OS signatures to tell us if the
requestor is on a mobile platform. This is the best method because the
set of known operating systems and browsers is small, stable, and manageable.
<br><br>
<a href="http://codepen.io/TextGlass/pen/EVbygN?editors=101">CodePen example</a>
</p>
</li>
<li>
<p class="max">
<b>Can you use the Device domain to do mobile detection?</b>
<br><br>
Yes, classify an HTTP User-Agent string against the Device domain and
check if the "mobile" attribute is set to "true".
This method relies on identifying the actual device to tell us if the
requestor is on a known mobile device. The downside to this method is
that TextGlass can only identify devices which have been defined in the
Device domain. The set of mobile devices is large and always changing.
<br><br>
<a href="http://codepen.io/TextGlass/pen/gaXMmB?editors=101">CodePen example</a>
</p>
</li>
<li>
<p class="max">
<b>How do you detect tablets?</b>
<br><br>
Using the Device domain, check if "tablet" is set to "true".
<br><br>
<a href="http://codepen.io/TextGlass/pen/gaXMmB?editors=101">CodePen example</a>
</p>
</li>
<li>
<p class="max">
<b>How do you detect web crawlers, search engines, and bots?</b>
<br><br>
Using the Device domain, check if "bot" is set to "true".
<br><br>
<a href="http://codepen.io/TextGlass/pen/gaXMmB?editors=101">CodePen example</a>
</p>
</li>
<li>
<p class="max">
<b>Is TextGlass some kind of NLP engine?</b>
<br><br>
TextGlass only performs one part of a classical NLP system:
named entity recognition. Each domain can be considered an independent
entity index.
</p>
</li>
<li>
<p class="max">
<b>Can TextGlass be used as a WAF?</b>
<br><br>
Absolutely. The domain specification is forward compatible with the type of
advanced pattern matching functionality a WAF would require. When a security domain
is used on an HTTP platform like Varnish, Nginx, or Apache, the result is a WAF.
</p>
</li>
<li>
<p class="max">
<b>How can I contribute?</b>
<br><br>
By creating issues on the Github project pages for missing devices, browsers,
and operating systems. Also, by contributing TextGlass clients
for languages and platforms we do not support. Please use the reference
client and the TextGlass specification for creating new clients.
</p>
</li>
<li>
<p class="max">
<b>Does TextGlass compete with commericial vendors?</b>
<br><br>
No, we encourge 3rd parties to leverage the TextGlass ecosystem
by creating their own TextGlass domains (please see the TextGlass specification).
3rd parties, open source or commercial, are free to distribute their
TextGlass domains using their own licensing model, free or paid.
</p>
</li>
</ul>
<br>
<div class="copyright">Copyright (c) 2015-2019 TextGlass</div><br>
</div>
<script src="trunk/javascript/js/textglass.js"></script>
<script>
var textglass = textglass || {};
function main() {
var browserURL = "//textglass.org/trunk/browser/domain/patterns.json";
var osURL = "//textglass.org/trunk/os/domain/patterns.json";
if(textglass.loaded) {
textglass.loadURLs(browserURL, undefined, undefined, undefined, domainReady);
textglass.loadURLs(osURL, undefined, undefined, undefined, domainReady);
} else {
get('demotext').innerHTML = 'Error, couldn\'t load TextGlass Javascript client.';
}
}
function get(id) {
return document.getElementById(id);
}
function domainReady(state, msg, domain) {
if(state === 'error') {
get('demotext').innerHTML = msg;
} else if(textglass.domains.browser && textglass.domains.os) {
var browser = textglass.domains.browser.classify(navigator.userAgent);
var os = textglass.domains.os.classify(navigator.userAgent);
if(browser.unknown) {
get('demotext').innerHTML = 'You are using an unknown browser.';
} else {
get('demotext').innerHTML = 'Your browser is ' + browser.name +
(browser.version? ' version ' + browser.version : '') + '.';
}
if(os.unknown) {
get('demotext').innerHTML += ' You are using an unknown operating system.';
} else {
get('demotext').innerHTML += ' Your operating system is ' + os.name +
(os.version ? ' ' + os.version : '') + '.';
}
if(browser.mobile === 'true' || os.mobile === 'true') {
get('demotext').innerHTML += ' You are on a mobile device.';
}
}
}
main();
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66901165-1', 'auto');
ga('send', 'pageview');
</script>
</div>
</body>
</html>