├── CHANGELOG ├── README.md ├── bower.json ├── css └── jquery.reject.css ├── doc.html ├── images ├── background_browser.gif ├── browser_chrome.gif ├── browser_firefox.gif ├── browser_konqueror.gif ├── browser_msie.gif ├── browser_opera.gif └── browser_safari.gif ├── jReject.jquery.json └── js └── jquery.reject.js /CHANGELOG: -------------------------------------------------------------------------------- 1 | Version 1.1.1 - 1.1.4 2 | - Minor Browser Detection Fixes 3 | - Addition of bower.json for package management 4 | 5 | Version 1.1.0 6 | - Updated browser icons to higher resolutions 7 | - Removed deprecated Google Chrome Frame from browser list 8 | - Updated Google Analytics tracking to use latest Analytics code 9 | - New Feature: Support rejection by max version number instead of only bolean values. (Example: mise: 8) 10 | - Assorted bug fixes. See Github Issues 11 | 12 | Version 1.0.2 13 | - Fix safari version detection for Chrome 23 on iOS 14 | 15 | Version 1.0.1 16 | - Supports not showing the browser download links (useless on iOS) 17 | - Passes JSLint 18 | 19 | Version 1.0.0: 20 | - Same as 1.0-RC2 21 | 22 | Version 1.0-RC2: 23 | - Cleanup code to support updated coding standards 24 | - Merge browser plugin into main source 25 | - Move CSS definitions to external file 26 | 27 | Version 1.0-RC1: 28 | - Fix issues with double-digit version numbers in browser agents. 29 | Thanks to Akkuma for the fix. Now using a custom version of Browser plugin. 30 | - BREAKING CHANGE: Default image dir now ./images/, instead of /images/. 31 | Could potentially break some legacy installations. 32 | - Update Browser Versions 33 | 34 | Version 0.7-Beta: 35 | - Improve Cookie Management; add cookie option with path and expiration settings 36 | - Update default browser versions and links 37 | - New: Fades in on load (with new opts.fadeInTime) 38 | - Bug Fix: Force browser focus to modal window (fixes ESC Key issues with frames/forms) 39 | - Bug Fix: Fix conflict with multiple rejections on a single page, and then closing window with ESC Key 40 | 41 | Version 0.6.1-Beta: 42 | - Make icons clickable to same URL as text links 43 | - Links now generate random popup names instead of just '_new' 44 | - Default browser display settings are now passed to options.beforeReject() event method 45 | - Code/comments cleanup 46 | 47 | Version 0.6-Beta: 48 | - Add opts.closeCookie and functionality to remmember closes 49 | - Allow closing of window via ESC key via opts.closeESC 50 | - Added parameters to event functions 51 | - Add opts.overlayBgColor and opts.overlayOpacity 52 | - Rename #jr_bg to #jr_overlay 53 | - Make popup position static; move with scroll/window resizing 54 | - Remove "return" requirement for click events; removed from demos 55 | - Hide/show "embed, object, select, applet" elements because they show above overlay 56 | - Remove opts.width/opts.height (now determined dynamically) 57 | - Improve issues with included CSS files affecting display 58 | - Fix opts.closeURL issues with default option ('#') 59 | - Add options to browserInfo to allow display restrictions 60 | - Add 'all' to browser reject options 61 | - Make browser display settings "cascade" 62 | - Improve DOM/CSS traversing efficiency 63 | - Fix display bugs in IE 64 | - Other Misc. Bug Fixes / Efficiency improvements 65 | 66 | Version 0.5-Beta: 67 | - Initial Version 68 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [jReject](http://jreject.turnwheel.com/) - jQuery Browser Rejection Plugin 2 | ================================ 3 | 4 | ⚠️ Unmaintained: This project is no longer maintained, and may not be compatible with latest browser versions. 5 | Please seek alternatives for similar functionality. 6 | =================== 7 | 8 | Created by Steven Bower 9 | 10 | TurnWheel Designs (2009-2014) 11 | 12 | Concept based on "IE6 Upgrade Warning" library. 13 | 14 | View doc.html for documentation and examples, or 15 | visit [jreject.turnwheel.com](http://jreject.turnwheel.com/) 16 | 17 | **Important Note about jQuery Versions** 18 | Supported by jQuery 1.7+ & 2.0+ 19 | If you wish to reject IE 6-8 or earlier, you must use jQuery 1.11.x or lower. 20 | 21 | Licensing: 22 | ----------------- 23 | This library is dual licensed under the MIT and GPLv2 licenses. 24 | 25 | Default Options: 26 | ----------------- 27 | options = { 28 | // Specifies which browsers/versions will be blocked 29 | reject : { 30 | all: false, // Covers Everything (Nothing blocked) 31 | msie: 6 // Covers MSIE <= 6 (Blocked by default) 32 | /* 33 | * Many possible combinations. 34 | * You can specify browser (msie, chrome, firefox) 35 | * You can specify rendering engine (geko, trident) 36 | * You can specify OS (Win, Mac, Linux, Solaris, iPhone, iPad) 37 | * 38 | * You can specify versions of each. 39 | * Examples: msie9: true, firefox8: true, 40 | * 41 | * You can specify the highest number to reject. 42 | * Example: msie: 9 (9 and lower are rejected. 43 | * 44 | * There is also "unknown" that covers what isn't detected 45 | * Example: unknown: true 46 | */ 47 | }, 48 | display: [], // What browsers to display and their order (default set below) 49 | browserShow: true, // Should the browser options be shown? 50 | browserInfo: { // Settings for which browsers to display 51 | chrome: { 52 | // Text below the icon 53 | text: 'Google Chrome', 54 | // URL For icon/text link 55 | url: 'http://www.google.com/chrome/', 56 | // (Optional) Use "allow" to customized when to show this option 57 | // Example: to show chrome only for IE users 58 | // allow: { all: false, msie: true } 59 | }, 60 | firefox: { 61 | text: 'Mozilla Firefox', 62 | url: 'http://www.mozilla.com/firefox/' 63 | }, 64 | safari: { 65 | text: 'Safari', 66 | url: 'http://www.apple.com/safari/download/' 67 | }, 68 | opera: { 69 | text: 'Opera', 70 | url: 'http://www.opera.com/download/' 71 | }, 72 | msie: { 73 | text: 'Internet Explorer', 74 | url: 'http://www.microsoft.com/windows/Internet-explorer/' 75 | } 76 | }, 77 | 78 | // Pop-up Window Text 79 | header: 'Did you know that your Internet Browser is out of date?', 80 | 81 | paragraph1: 'Your browser is out of date, and may not be compatible with '+ 82 | 'our website. A list of the most popular web browsers can be '+ 83 | 'found below.', 84 | 85 | paragraph2: 'Just click on the icons to get to the download page', 86 | 87 | // Allow closing of window 88 | close: true, 89 | 90 | // Message displayed below closing link 91 | closeMessage: 'By closing this window you acknowledge that your experience '+ 92 | 'on this website may be degraded', 93 | closeLink: 'Close This Window', 94 | closeURL: '#', 95 | 96 | // Allows closing of window with esc key 97 | closeESC: true, 98 | 99 | // Use cookies to remmember if window was closed previously? 100 | closeCookie: false, 101 | // Cookie settings are only used if closeCookie is true 102 | cookieSettings: { 103 | // Path for the cookie to be saved on 104 | // Should be root domain in most cases 105 | path: '/', 106 | // Expiration Date (in seconds) 107 | // 0 (default) means it ends with the current session 108 | expires: 0 109 | }, 110 | 111 | // Path where images are located 112 | imagePath: './images/', 113 | // Background color for overlay 114 | overlayBgColor: '#000', 115 | // Background transparency (0-1) 116 | overlayOpacity: 0.8, 117 | 118 | // Fade in time on open ('slow','medium','fast' or integer in ms) 119 | fadeInTime: 'fast', 120 | // Fade out time on close ('slow','medium','fast' or integer in ms) 121 | fadeOutTime: 'fast', 122 | 123 | // Google Analytics Link Tracking (Optional) 124 | // Set to true to enable 125 | // Note: Analytics tracking code must be added separately 126 | analytics: false 127 | }; 128 | 129 | Run On load (Default Options): 130 | $(function() { 131 | $.reject(); 132 | }); 133 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "TurnWheel/jReject", 3 | "version": "1.1.5", 4 | "main": [ 5 | "js/jquery.reject.js", 6 | "css/jquery.reject.css", 7 | "images/" 8 | ], 9 | "description": "jQuery Browser Rejection Plugin", 10 | "license": "GPLv2", 11 | "ignore": [ 12 | ".jshintrc" 13 | ], 14 | "dependencies": { 15 | "jquery": ">=1.7.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /css/jquery.reject.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jReject (jQuery Browser Rejection Plugin) 3 | * Version 1.1.x 4 | * URL: http://jreject.turnwheel.com/ 5 | * Description: jReject is a easy method of rejecting specific browsers on your site 6 | * Author: Steven Bower (TurnWheel Designs) http://turnwheel.com/ 7 | * Copyright: Copyright (c) 2009-2014 Steven Bower under dual MIT/GPL license. 8 | */ 9 | 10 | #jr_overlay { 11 | top: 0; 12 | left: 0; 13 | padding: 0; 14 | margin: 0; 15 | z-index: 2147483646; 16 | position: absolute; 17 | } 18 | 19 | #jr_wrap { 20 | position: absolute; 21 | width: 100%; 22 | z-index: 2147483647; 23 | padding: 0; 24 | margin: 0; 25 | } 26 | 27 | #jr_inner { 28 | font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, Verdana, sans-serif; 29 | font-size: 12px; 30 | background: #FFF; 31 | border: 1px solid #CCC; 32 | color: #4F4F4F; 33 | margin: 0 auto; 34 | height: auto; 35 | padding: 20px; 36 | position: relative; 37 | box-sizing: content-box; 38 | } 39 | 40 | #jr_header { 41 | display: block; 42 | color: #333; 43 | padding: 5px; 44 | padding-bottom: 0; 45 | margin: 0; 46 | font-family: Helvetica, Arial, sans-serif; 47 | font-weight: bold; 48 | font-size: 1.3em; 49 | margin-bottom: 0.5em; 50 | } 51 | 52 | #jr_inner p { 53 | padding: 5px; 54 | margin: 0; 55 | } 56 | 57 | #jr_inner ul { 58 | list-style-image: none; 59 | list-style-position: outside; 60 | list-style-type: none; 61 | margin: 0; 62 | padding: 0; 63 | } 64 | 65 | #jr_inner ul li { 66 | cursor: pointer; 67 | float: left; 68 | width: 120px; 69 | height: 122px; 70 | margin: 0 10px 10px 10px; 71 | padding: 0; 72 | text-align: center; 73 | } 74 | 75 | #jr_inner li a { 76 | color: #333; 77 | font-size: 0.8em; 78 | text-decoration: none; 79 | padding: 0; 80 | margin: 0; 81 | } 82 | 83 | #jr_inner li a:hover { 84 | text-decoration: underline; 85 | } 86 | 87 | #jr_inner .jr_icon { 88 | width: 100px; 89 | height: 100px; 90 | margin: 1px auto; 91 | padding: 0; 92 | background: transparent no-repeat scroll left top; 93 | cursor: pointer; 94 | } 95 | 96 | #jr_close { 97 | clear: both; 98 | padding: 0; 99 | margin: 0; 100 | } 101 | 102 | #jr_close a { 103 | color: #000; 104 | display: block; 105 | width: auto; 106 | margin: 0; 107 | padding: 0; 108 | text-decoration: underline; 109 | } 110 | 111 | #jr_close p { 112 | padding: 10px 0 0 0; 113 | margin: 0; 114 | } 115 | -------------------------------------------------------------------------------- /doc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jReject - jQuery Plugin for Simple Browser Rejection 6 | 7 | 8 | 9 | 103 | 104 | 105 | 106 | 244 | 245 | 246 |
247 |
248 |

jReject: jQuery Browser Rejection

249 |

250 | jReject is a simple, light-weight library designed to 251 | display a popup based on the browser, specific browser version, 252 | specific platforms, or rendering engine. Provides full customization 253 | of the popup, and uses a small CSS file. Can easily be used on page load 254 | or during a specific page event. Also provides a flexible way to beautifully 255 | and cleanly display custom browser alternatives in the popup. 256 |

257 | 258 |

Requirements

259 |

jQuery 1.7+

260 | 261 |

Makes Use Of

262 | jQuery Browser Plugin - Updated version included in default package. 263 | (View Original) 264 | 265 |

Download jReject

266 |

267 | Get Latest At GitHub 268 |

269 |

270 | If you are a developer familiar with using jQuery, continue with the documentation below. 271 |

272 | 273 |
274 | 275 |

Documentation

276 |
277 |

278 | The object is called "reject", and can be invoked once the document 279 | is ready ($.reject() or jQuery.reject()). The first parameter 280 | contains all the options and configurations for the plugin. 281 |

282 | 283 |

Default Options

284 |

285 | Here are the default options for the first parameter of the reject 286 | object. You only need to specify those which you wish to override. 287 |

288 | 289 |
290 | options = {
291 | 	// Specifies which browsers/versions will be blocked
292 | 	reject : {
293 | 		all: false, // Covers Everything (Nothing blocked)
294 | 		msie: 6 // Covers MSIE <= 6 (Blocked by default)
295 | 		/*
296 | 		* Many possible combinations.
297 | 		* You can specify browser (msie, chrome, firefox)
298 | 		* You can specify rendering engine (geko, trident)
299 | 		* You can specify OS (Win, Mac, Linux, Solaris, iPhone, iPad)
300 | 		*
301 | 		* You can specify versions of each.
302 | 		* Examples: msie9: true, firefox8: true,
303 | 		*
304 | 		* You can specify the highest number to reject.
305 | 		* Example: msie: 9 (9 and lower are rejected.
306 | 		*
307 | 		* There is also "unknown" that covers what isn't detected
308 | 		* Example: unknown: true
309 | 		*/
310 | 	},
311 | 	display: [], // What browsers to display and their order (default set below)
312 | 	browserShow: true, // Should the browser options be shown?
313 | 	browserInfo: { // Settings for which browsers to display
314 | 		chrome: {
315 | 			// Text below the icon
316 | 			text: 'Google Chrome',
317 | 			// URL For icon/text link
318 | 			url: 'http://www.google.com/chrome/',
319 | 			// (Optional) Use "allow" to customized when to show this option
320 | 			// Example: to show chrome only for IE users
321 | 			// allow: { all: false, msie: true }
322 | 		},
323 | 		firefox: {
324 | 			text: 'Mozilla Firefox',
325 | 			url: 'http://www.mozilla.com/firefox/'
326 | 		},
327 | 		safari: {
328 | 			text: 'Safari',
329 | 			url: 'http://www.apple.com/safari/download/'
330 | 		},
331 | 		opera: {
332 | 			text: 'Opera',
333 | 			url: 'http://www.opera.com/download/'
334 | 		},
335 | 		msie: {
336 | 			text: 'Internet Explorer',
337 | 			url: 'http://www.microsoft.com/windows/Internet-explorer/'
338 | 		}
339 | 	},
340 | 
341 | 	// Pop-up Window Text
342 | 	header: 'Did you know that your Internet Browser is out of date?',
343 | 
344 | 	paragraph1: 'Your browser is out of date, and may not be compatible with '+
345 | 				'our website. A list of the most popular web browsers can be '+
346 | 				'found below.',
347 | 
348 | 	paragraph2: 'Just click on the icons to get to the download page',
349 | 
350 | 	// Allow closing of window
351 | 	close: true,
352 | 
353 | 	// Message displayed below closing link
354 | 	closeMessage: 'By closing this window you acknowledge that your experience '+
355 | 					'on this website may be degraded',
356 | 	closeLink: 'Close This Window',
357 | 	closeURL: '#',
358 | 
359 | 	// Allows closing of window with esc key
360 | 	closeESC: true,
361 | 
362 | 	// Use cookies to remmember if window was closed previously?
363 | 	closeCookie: false,
364 | 	// Cookie settings are only used if closeCookie is true
365 | 	cookieSettings: {
366 | 		// Path for the cookie to be saved on
367 | 		// Should be root domain in most cases
368 | 		path: '/',
369 | 		// Expiration Date (in seconds)
370 | 		// 0 (default) means it ends with the current session
371 | 		expires: 0
372 | 	},
373 | 
374 | 	// Path where images are located
375 | 	imagePath: './images/',
376 | 	// Background color for overlay
377 | 	overlayBgColor: '#000',
378 | 	// Background transparency (0-1)
379 | 	overlayOpacity: 0.8,
380 | 
381 | 	// Fade in time on open ('slow','medium','fast' or integer in ms)
382 | 	fadeInTime: 'fast',
383 | 	// Fade out time on close ('slow','medium','fast' or integer in ms)
384 | 	fadeOutTime: 'fast',
385 | 
386 | 	// Google Analytics Link Tracking (Optional)
387 | 	// Set to true to enable
388 | 	// Note: Analytics tracking code must be added separately
389 | 	analytics: false
390 | };
391 | 			
392 |

393 | 394 |

Optional Event Methods

395 | options.beforeReject()
396 |

Called before rejection is determined.


397 | 398 | options.afterReject()
399 |

Called after rejection window has been created, for browsers that matched the rejection settings.


400 | 401 | options.onFail()
402 |

Called if the browser does NOT meet the rejection requirements


403 | 404 | options.beforeClose()
405 |

Called after close button is clicked, but before popup is actually closed.


406 | 407 | options.afterClose()
408 |

Called after rejection popup is closed


409 | 410 |

411 | Note: All callbacks can access and edit options by using this
412 | View Demo #8 as an example 413 |

414 | 415 |

Browser Plugin Options

416 | 425 | $.browser.className =
426 | $.browser.name =
427 | $,browser.version =
428 | $.browser.versionX =
429 | $.os.name =
430 | 431 |
432 | 433 |

Example Usage

434 | 435 |
436 |

Demo #1: Default Settings

437 | Run Demo
438 | 439 |

440 | If nothing happened when you ran this demo, that is because you are not using IE6!
441 | By default (no settings specified) the reject function only rejects IE5 and IE6. 442 |

443 | 444 |
445 | $('#demo1').click(function() {
446 | 	$.reject(); // Default Settings
447 | 	return false;
448 | });
449 | 			
450 |
451 | 452 |
453 | 454 |
455 |

Demo #2: Customize Browsers To Reject

456 | Run Demo
457 | 458 |

459 | In this example pretty much every browser should be rejected. 460 |

461 | 462 |
463 | $('#demo2').click(function() {
464 | 	$.reject({
465 | 		reject: {
466 | 			safari: true, // Apple Safari
467 | 			chrome: true, // Google Chrome
468 | 			firefox: true, // Mozilla Firefox
469 | 			msie: true, // Microsoft Internet Explorer
470 | 			opera: true, // Opera
471 | 			konqueror: true, // Konqueror (Linux)
472 | 			unknown: true // Everything else
473 | 		}
474 | 	}); // Customized Browsers
475 | 
476 | 	return false;
477 | });
478 | 			
479 |
480 | 481 |
482 | 483 |
484 |

Demo #3: Customize Popup Text

485 | Run Demo
486 | 487 |

488 | In this demo we use customized text in the popup window. 489 | This demo uses the following properties:
490 | header, 491 | paragraph1, 492 | paragraph2, 493 | closeMessage
494 | 495 | See Also closeLink 496 |

497 | 498 |
499 | $('#demo3').click(function() {
500 | 	$.reject({
501 | 		reject: { all: true }, // Reject all renderers for demo
502 | 		header: 'Your browser is not supported here', // Header Text
503 | 		paragraph1: 'You are currently using an unsupported browser', // Paragraph 1
504 | 		paragraph2: 'Please install one of the many optional browsers below to proceed',
505 | 		closeMessage: 'Close this window at your own demise!' // Message below close window link
506 | 	}); // Customized Text
507 | 
508 | 	return false;
509 | });
510 | 			
511 |
512 | 513 |
514 | 515 |
516 |

Demo #4: Customize Browsers To Suggest

517 | Run Demo
518 | 519 |

520 | Using the display option, you can define 521 | which browsers to suggest, and the order in which to suggest them. 522 |

523 |

524 | Default: ['firefox','chrome','msie','safari','opera'] 525 |

526 | 527 |
528 | $('#demo4').click(function() {
529 | 	$.reject({
530 | 		reject: { all: true }, // Reject all renderers for demo
531 | 		display: ['firefox','chrome','opera'] // Displays only firefox, chrome, and opera
532 | 	});
533 | 
534 | 	return false;
535 | });
536 | 			
537 |
538 | 539 |
540 | 541 |
542 |

Demo #5: Customize Your Own Browser Suggestion

543 | Run Demo
544 | 545 |

546 | You can even add a customized browser to the list, and display it in any order you want. 547 |

548 |

549 | Note: To add your own icon, you need to create a 'browser_{browserName}.gif'
550 | file and place it in your imagePath directory with the other images.
551 | Image Dimensions: 100x100
552 |

553 | 554 |
555 | $('#demo5').click(function() {
556 | 	$.reject({
557 | 		reject: { all: true }, // Reject all renderers for demo
558 | 		// Displays only custom "Konqueror" browser, firefox and opera.
559 | 		display: ['konqueror','firefox','opera'],
560 | 		browserInfo: {
561 | 			konqueror: { // Specifies browser name and image name (browser_konqueror.gif)
562 | 				text: 'Konqueror 4', // Text Link
563 | 				url: 'http://konqueror.kde.org/' // URL To link to
564 | 			}
565 | 		}
566 | 	});
567 | 
568 | 	return false;
569 | });
570 | 			
571 |
572 | 573 |
574 | 575 |
576 |

Demo #6: Display Once Per Session

577 | Run Demo
578 | 579 |

580 | By using the closeCookie option, you 581 | can make the window only appear once per session.
582 | 583 | After it pops up the first time, this demo will not popup again 584 | until next browser session. 585 |

586 |

587 | Note: This requires the ability to close the window. 588 | If close is false the cookie will never be set. 589 |

590 | 591 |
592 | $('#demo6').click(function() {
593 | 	$.reject({
594 | 		reject: { all: true }, // Reject all renderers for demo
595 | 		closeCookie: true // Set cookie to remmember close for this session
596 | 	});
597 | 
598 | 	return false;
599 | });
600 | 			
601 |
602 | 603 |
604 | 605 |
606 |

Demo #7: Disable ability to close window

607 | Run Demo
608 | 609 |

610 | The close option allows 611 | you to hide the closeLink 612 | or closeMessage elements from displaying.
613 | 614 | This prevents the user from closing the window. If you 615 | use this on a onLoad event, the user will never be able to use your site. 616 |

617 |

618 | Note: Testing this demo will require you to 619 | refresh the page to close out the popup window. 620 |

621 | 622 |
623 | $('#demo7').click(function() {
624 | 	$.reject({
625 | 		reject: { all: true }, // Reject all renderers for demo
626 | 		close: false, // Prevent closing of window
627 | 		paragraph1: 'You will not be able to close this window', // Warning about closing
628 | 		paragraph2: 'To exit, you must '+
629 | 		'<a href="javascript:window.location=window.location.pathname;">refresh the page</a>'
630 | 	});
631 | 
632 | 	return false;
633 | });
634 | 			
635 |
636 | 637 |
638 | 639 |
640 |

Demo #8: Customize by Browser

641 | Run Demo
642 | 643 |

644 | This example uses the beforeReject callback to change options by browser.
645 | In chrome, only FireFox and Opera options will be displayed. iPhone/iPad displays no browser options 646 |

647 | 648 |
649 | 
650 | $('#demo8').click(function() {
651 | 	$.reject({
652 | 		reject: { all: true }, // Reject all renderers for demo
653 | 		beforeReject: function() {
654 | 			if ($.browser.name === 'chrome') {
655 | 				this.display = ['firefox','opera'];
656 | 			}
657 | 			if ($.os.name === 'iphone' || $.os.name === 'ipad') {
658 | 				this.browserShow = false;
659 | 				this.paragraph2 = '';
660 | 			}
661 | 		}
662 | 	});
663 | 
664 | 	return false;
665 | });
666 | 			
667 |
668 | 669 | 676 |
677 | 678 |
679 | 680 | 681 | 682 | -------------------------------------------------------------------------------- /images/background_browser.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TurnWheel/jReject/04f95eb2a5419b738b1576154caec92f013fed72/images/background_browser.gif -------------------------------------------------------------------------------- /images/browser_chrome.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TurnWheel/jReject/04f95eb2a5419b738b1576154caec92f013fed72/images/browser_chrome.gif -------------------------------------------------------------------------------- /images/browser_firefox.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TurnWheel/jReject/04f95eb2a5419b738b1576154caec92f013fed72/images/browser_firefox.gif -------------------------------------------------------------------------------- /images/browser_konqueror.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TurnWheel/jReject/04f95eb2a5419b738b1576154caec92f013fed72/images/browser_konqueror.gif -------------------------------------------------------------------------------- /images/browser_msie.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TurnWheel/jReject/04f95eb2a5419b738b1576154caec92f013fed72/images/browser_msie.gif -------------------------------------------------------------------------------- /images/browser_opera.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TurnWheel/jReject/04f95eb2a5419b738b1576154caec92f013fed72/images/browser_opera.gif -------------------------------------------------------------------------------- /images/browser_safari.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TurnWheel/jReject/04f95eb2a5419b738b1576154caec92f013fed72/images/browser_safari.gif -------------------------------------------------------------------------------- /jReject.jquery.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jReject", 3 | "title": "jQuery Browser Rejection", 4 | "description": "jReject is a simple tool for rejecting specific browsers in a nice modal window", 5 | "keywords": [ 6 | "browser", 7 | "reject", 8 | "popup" 9 | ], 10 | "version": "1.1.0", 11 | "author": { 12 | "name": "Steven Bower", 13 | "url": "https://github.com/BluSyn" 14 | }, 15 | "licenses": [ 16 | { 17 | "type": "MIT", 18 | "url": "http://opensource.org/licenses/MIT" 19 | }, 20 | { 21 | "type": "GPLv2", 22 | "url": "http://opensource.org/licenses/GPL-2.0" 23 | } 24 | ], 25 | "bugs": "https://github.com/TurnWheel/jReject/issues", 26 | "homepage": "http://jreject.turnwheel.com", 27 | "docs": "http://jreject.turnwheel.com", 28 | "download": "https://github.com/TurnWheel/jReject/archive/1.1.0.zip", 29 | "dependencies": { 30 | "jquery": ">=1.7" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /js/jquery.reject.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jReject (jQuery Browser Rejection Plugin) 3 | * Version 1.1.x 4 | * URL: http://jreject.turnwheel.com/ 5 | * Description: jReject is a easy method of rejecting specific browsers on your site 6 | * Author: Steven Bower (TurnWheel Designs) http://turnwheel.com/ 7 | * Copyright: Copyright (c) 2009-2014 Steven Bower under dual MIT/GPLv2 license. 8 | */ 9 | 10 | (function($) { 11 | $.reject = function(options) { 12 | var opts = $.extend(true, { 13 | // Specifies which browsers/versions will be blocked 14 | reject : { 15 | all: false, // Covers Everything (Nothing blocked) 16 | msie: 6 // Covers MSIE <= 6 (Blocked by default) 17 | /* 18 | * Many possible combinations. 19 | * You can specify browser (msie, chrome, firefox) 20 | * You can specify rendering engine (geko, trident) 21 | * You can specify OS (Win, Mac, Linux, Solaris, iPhone, iPad) 22 | * 23 | * You can specify versions of each. 24 | * Examples: msie9: true, firefox8: true, 25 | * 26 | * You can specify the highest number to reject. 27 | * Example: msie: 9 (9 and lower are rejected. 28 | * 29 | * There is also "unknown" that covers what isn't detected 30 | * Example: unknown: true 31 | */ 32 | }, 33 | display: [], // What browsers to display and their order (default set below) 34 | browserShow: true, // Should the browser options be shown? 35 | browserInfo: { // Settings for which browsers to display 36 | chrome: { 37 | // Text below the icon 38 | text: 'Google Chrome', 39 | // URL For icon/text link 40 | url: 'http://www.google.com/chrome/' 41 | // (Optional) Use "allow" to customized when to show this option 42 | // Example: to show chrome only for IE users 43 | // allow: { all: false, msie: true } 44 | }, 45 | firefox: { 46 | text: 'Mozilla Firefox', 47 | url: 'http://www.mozilla.com/firefox/' 48 | }, 49 | safari: { 50 | text: 'Safari', 51 | url: 'http://www.apple.com/safari/download/' 52 | }, 53 | opera: { 54 | text: 'Opera', 55 | url: 'http://www.opera.com/download/' 56 | }, 57 | msie: { 58 | text: 'Internet Explorer', 59 | url: 'http://www.microsoft.com/windows/Internet-explorer/' 60 | } 61 | }, 62 | 63 | // Pop-up Window Text 64 | header: 'Did you know that your Internet Browser is out of date?', 65 | 66 | paragraph1: 'Your browser is out of date, and may not be compatible with '+ 67 | 'our website. A list of the most popular web browsers can be '+ 68 | 'found below.', 69 | 70 | paragraph2: 'Just click on the icons to get to the download page', 71 | 72 | // Allow closing of window 73 | close: true, 74 | 75 | // Message displayed below closing link 76 | closeMessage: 'By closing this window you acknowledge that your experience '+ 77 | 'on this website may be degraded', 78 | closeLink: 'Close This Window', 79 | closeURL: '#', 80 | 81 | // Allows closing of window with esc key 82 | closeESC: true, 83 | 84 | // Use cookies to remmember if window was closed previously? 85 | closeCookie: false, 86 | // Cookie settings are only used if closeCookie is true 87 | cookieSettings: { 88 | // Path for the cookie to be saved on 89 | // Should be root domain in most cases 90 | path: '/', 91 | // Expiration Date (in seconds) 92 | // 0 (default) means it ends with the current session 93 | expires: 0 94 | }, 95 | 96 | // Path where images are located 97 | imagePath: './images/', 98 | // Background color for overlay 99 | overlayBgColor: '#000', 100 | // Background transparency (0-1) 101 | overlayOpacity: 0.8, 102 | 103 | // Fade in time on open ('slow','medium','fast' or integer in ms) 104 | fadeInTime: 'fast', 105 | // Fade out time on close ('slow','medium','fast' or integer in ms) 106 | fadeOutTime: 'fast', 107 | 108 | // Google Analytics Link Tracking (Optional) 109 | // Set to true to enable 110 | // Note: Analytics tracking code must be added separately 111 | analytics: false 112 | }, options); 113 | 114 | // Set default browsers to display if not already defined 115 | if (opts.display.length < 1) { 116 | opts.display = [ 'chrome','firefox','safari','opera','msie' ]; 117 | } 118 | 119 | // beforeRject: Customized Function 120 | if ($.isFunction(opts.beforeReject)) { 121 | opts.beforeReject(); 122 | } 123 | 124 | // Disable 'closeESC' if closing is disabled (mutually exclusive) 125 | if (!opts.close) { 126 | opts.closeESC = false; 127 | } 128 | 129 | // This function parses the advanced browser options 130 | var browserCheck = function(settings) { 131 | // Check 1: Look for 'all' forced setting 132 | // Check 2: Browser+major version (optional) (eg. 'firefox','msie','{msie: 6}') 133 | // Check 3: Browser+major version (eg. 'firefox3','msie7','chrome4') 134 | // Check 4: Rendering engine+version (eg. 'webkit', 'gecko', '{webkit: 537.36}') 135 | // Check 5: Operating System (eg. 'win','mac','linux','solaris','iphone') 136 | var layout = settings[$.layout.name], 137 | browser = settings[$.browser.name]; 138 | return !!(settings['all'] 139 | || (browser && (browser === true || $.browser.versionNumber <= browser)) 140 | || settings[$.browser.className] 141 | || (layout && (layout === true || $.layout.versionNumber <= layout)) 142 | || settings[$.os.name]); 143 | }; 144 | 145 | // Determine if we need to display rejection for this browser, or exit 146 | if (!browserCheck(opts.reject)) { 147 | // onFail: Optional Callback 148 | if ($.isFunction(opts.onFail)) { 149 | opts.onFail(); 150 | } 151 | 152 | return false; 153 | } 154 | 155 | // If user can close and set to remmember close, initiate cookie functions 156 | if (opts.close && opts.closeCookie) { 157 | // Local global setting for the name of the cookie used 158 | var COOKIE_NAME = 'jreject-close'; 159 | 160 | // Cookies Function: Handles creating/retrieving/deleting cookies 161 | // Cookies are only used for opts.closeCookie parameter functionality 162 | var _cookie = function(name, value) { 163 | // Save cookie 164 | if (typeof value != 'undefined') { 165 | var expires = ''; 166 | 167 | // Check if we need to set an expiration date 168 | if (opts.cookieSettings.expires !== 0) { 169 | var date = new Date(); 170 | date.setTime(date.getTime()+(opts.cookieSettings.expires*1000)); 171 | expires = "; expires="+date.toGMTString(); 172 | } 173 | 174 | // Get path from settings 175 | var path = opts.cookieSettings.path || '/'; 176 | 177 | // Set Cookie with parameters 178 | document.cookie = name+'='+ 179 | encodeURIComponent((!value) ? '' : value)+expires+ 180 | '; path='+path; 181 | 182 | return true; 183 | } 184 | // Get cookie 185 | else { 186 | var cookie,val = null; 187 | 188 | if (document.cookie && document.cookie !== '') { 189 | var cookies = document.cookie.split(';'); 190 | 191 | // Loop through all cookie values 192 | var clen = cookies.length; 193 | for (var i = 0; i < clen; ++i) { 194 | cookie = $.trim(cookies[i]); 195 | 196 | // Does this cookie string begin with the name we want? 197 | if (cookie.substring(0,name.length+1) == (name+'=')) { 198 | var len = name.length; 199 | val = decodeURIComponent(cookie.substring(len+1)); 200 | break; 201 | } 202 | } 203 | } 204 | 205 | // Returns cookie value 206 | return val; 207 | } 208 | }; 209 | 210 | // If cookie is set, return false and don't display rejection 211 | if (_cookie(COOKIE_NAME)) { 212 | return false; 213 | } 214 | } 215 | 216 | // Load background overlay (jr_overlay) + Main wrapper (jr_wrap) + 217 | // Inner Wrapper (jr_inner) w/ opts.header (jr_header) + 218 | // opts.paragraph1/opts.paragraph2 if set 219 | var html = '
'+ 220 | '

'+opts.header+'

'+ 221 | (opts.paragraph1 === '' ? '' : '

'+opts.paragraph1+'

')+ 222 | (opts.paragraph2 === '' ? '' : '

'+opts.paragraph2+'

'); 223 | 224 | var displayNum = 0; 225 | if (opts.browserShow) { 226 | html += ''; 251 | } 252 | 253 | // Close list and #jr_list 254 | html += '
'+ 255 | // Display close links/message if set 256 | (opts.close ? ''+opts.closeLink+''+ 257 | '

'+opts.closeMessage+'

' : '')+'
'+ 258 | // Close #jr_inner and #jr_wrap 259 | '
'; 260 | 261 | var element = $('
'+html+'
'); // Create element 262 | var size = _pageSize(); // Get page size 263 | var scroll = _scrollSize(); // Get page scroll 264 | 265 | // This function handles closing this reject window 266 | // When clicked, fadeOut and remove all elements 267 | element.bind('closejr', function() { 268 | // Make sure the permission to close is granted 269 | if (!opts.close) { 270 | return false; 271 | } 272 | 273 | // Customized Function 274 | if ($.isFunction(opts.beforeClose)) { 275 | opts.beforeClose(); 276 | } 277 | 278 | // Remove binding function so it 279 | // doesn't get called more than once 280 | $(this).unbind('closejr'); 281 | 282 | // Fade out background and modal wrapper 283 | $('#jr_overlay,#jr_wrap').fadeOut(opts.fadeOutTime,function() { 284 | $(this).remove(); // Remove element from DOM 285 | 286 | // afterClose: Customized Function 287 | if ($.isFunction(opts.afterClose)) { 288 | opts.afterClose(); 289 | } 290 | }); 291 | 292 | // Show elements that were hidden for layering issues 293 | var elmhide = 'embed.jr_hidden, object.jr_hidden, select.jr_hidden, applet.jr_hidden'; 294 | $(elmhide).show().removeClass('jr_hidden'); 295 | 296 | // Set close cookie for next run 297 | if (opts.closeCookie) { 298 | _cookie(COOKIE_NAME, 'true'); 299 | } 300 | 301 | return true; 302 | }); 303 | 304 | // Tracks clicks in Google Analytics (category 'External Links') 305 | // only if opts.analytics is enabled 306 | var analytics = function(url) { 307 | if (!opts.analytics) { 308 | return false; 309 | } 310 | 311 | // Get just the hostname 312 | var host = url.split(/\/+/g)[1]; 313 | 314 | // Send external link event to Google Analaytics 315 | // Attempts both versions of analytics code. (Newest first) 316 | try { 317 | // Newest analytics code 318 | ga('send', 'event', 'External', 'Click', host, url); 319 | } catch (e) { 320 | try { 321 | _gaq.push([ '_trackEvent', 'External Links', host, url ]); 322 | } catch (e) { } 323 | } 324 | }; 325 | 326 | // Called onClick for browser links (and icons) 327 | // Opens link in new window 328 | var openBrowserLinks = function(url) { 329 | // Send link to analytics if enabled 330 | analytics(url); 331 | 332 | // Open window, generate random id value 333 | window.open(url, 'jr_'+ Math.round(Math.random()*11)); 334 | 335 | return false; 336 | }; 337 | 338 | /* 339 | * Trverse through element DOM and apply JS variables 340 | * All CSS elements that do not require JS will be in 341 | * css/jquery.jreject.css 342 | */ 343 | 344 | // Creates 'background' (div) 345 | element.find('#jr_overlay').css({ 346 | width: size[0], 347 | height: size[1], 348 | background: opts.overlayBgColor, 349 | opacity: opts.overlayOpacity 350 | }); 351 | 352 | // Wrapper for our pop-up (div) 353 | element.find('#jr_wrap').css({ 354 | top: scroll[1]+(size[3]/4), 355 | left: scroll[0] 356 | }); 357 | 358 | // Wrapper for inner centered content (div) 359 | element.find('#jr_inner').css({ 360 | minWidth: displayNum*100, 361 | maxWidth: displayNum*140, 362 | // min/maxWidth not supported by IE 363 | width: $.layout.name == 'trident' ? displayNum*155 : 'auto' 364 | }); 365 | 366 | element.find('#jr_inner li').css({ // Browser list items (li) 367 | background: 'transparent url("'+opts.imagePath+'background_browser.gif") '+ 368 | 'no-repeat scroll left top' 369 | }); 370 | 371 | element.find('#jr_inner li .jr_icon').each(function() { 372 | // Dynamically sets the icon background image 373 | var self = $(this); 374 | self.css('background','transparent url('+opts.imagePath+'browser_'+ 375 | (self.parent('li').attr('id').replace(/jr_/,''))+'.gif)'+ 376 | ' no-repeat scroll left top'); 377 | 378 | // Send link clicks to openBrowserLinks 379 | self.click(function () { 380 | var url = $(this).next('div').children('a').attr('href'); 381 | openBrowserLinks(url); 382 | }); 383 | }); 384 | 385 | element.find('#jr_inner li a').click(function() { 386 | openBrowserLinks($(this).attr('href')); 387 | return false; 388 | }); 389 | 390 | // Bind closing event to trigger closejr 391 | // to be consistant with ESC key close function 392 | element.find('#jr_close a').click(function() { 393 | $(this).trigger('closejr'); 394 | 395 | // If plain anchor is set, return false so there is no page jump 396 | if (opts.closeURL === '#') { 397 | return false; 398 | } 399 | }); 400 | 401 | // Set focus (fixes ESC key issues with forms and other focus bugs) 402 | $('#jr_overlay').focus(); 403 | 404 | // Hide elements that won't display properly 405 | $('embed, object, select, applet').each(function() { 406 | if ($(this).is(':visible')) { 407 | $(this).hide().addClass('jr_hidden'); 408 | } 409 | }); 410 | 411 | // Append element to body of document to display 412 | $('body').append(element.hide().fadeIn(opts.fadeInTime)); 413 | 414 | // Handle window resize/scroll events and update overlay dimensions 415 | $(window).bind('resize scroll',function() { 416 | var size = _pageSize(); // Get size 417 | 418 | // Update overlay dimensions based on page size 419 | $('#jr_overlay').css({ 420 | width: size[0], 421 | height: size[1] 422 | }); 423 | 424 | var scroll = _scrollSize(); // Get page scroll 425 | 426 | // Update modal position based on scroll 427 | $('#jr_wrap').css({ 428 | top: scroll[1] + (size[3]/4), 429 | left: scroll[0] 430 | }); 431 | }); 432 | 433 | // Add optional ESC Key functionality 434 | if (opts.closeESC) { 435 | $(document).bind('keydown',function(event) { 436 | // ESC = Keycode 27 437 | if (event.keyCode == 27) { 438 | element.trigger('closejr'); 439 | } 440 | }); 441 | } 442 | 443 | // afterReject: Customized Function 444 | if ($.isFunction(opts.afterReject)) { 445 | opts.afterReject(); 446 | } 447 | 448 | return true; 449 | }; 450 | 451 | // Based on compatibility data from quirksmode.com 452 | // This is used to help calculate exact center of the page 453 | var _pageSize = function() { 454 | var xScroll = window.innerWidth && window.scrollMaxX ? 455 | window.innerWidth + window.scrollMaxX : 456 | (document.body.scrollWidth > document.body.offsetWidth ? 457 | document.body.scrollWidth : document.body.offsetWidth); 458 | 459 | var yScroll = window.innerHeight && window.scrollMaxY ? 460 | window.innerHeight + window.scrollMaxY : 461 | (document.body.scrollHeight > document.body.offsetHeight ? 462 | document.body.scrollHeight : document.body.offsetHeight); 463 | 464 | var windowWidth = window.innerWidth ? window.innerWidth : 465 | (document.documentElement && document.documentElement.clientWidth ? 466 | document.documentElement.clientWidth : document.body.clientWidth); 467 | 468 | var windowHeight = window.innerHeight ? window.innerHeight : 469 | (document.documentElement && document.documentElement.clientHeight ? 470 | document.documentElement.clientHeight : document.body.clientHeight); 471 | 472 | return [ 473 | xScroll < windowWidth ? xScroll : windowWidth, // Page Width 474 | yScroll < windowHeight ? windowHeight : yScroll, // Page Height 475 | windowWidth,windowHeight 476 | ]; 477 | }; 478 | 479 | 480 | // Based on compatibility data from quirksmode.com 481 | var _scrollSize = function() { 482 | return [ 483 | // scrollSize X 484 | window.pageXOffset ? window.pageXOffset : (document.documentElement && 485 | document.documentElement.scrollTop ? 486 | document.documentElement.scrollLeft : document.body.scrollLeft), 487 | 488 | // scrollSize Y 489 | window.pageYOffset ? window.pageYOffset : (document.documentElement && 490 | document.documentElement.scrollTop ? 491 | document.documentElement.scrollTop : document.body.scrollTop) 492 | ]; 493 | }; 494 | })(jQuery); 495 | 496 | /* 497 | * jQuery Browser Plugin 498 | * Version 2.4 / jReject 1.0.x 499 | * URL: http://jquery.thewikies.com/browser 500 | * Description: jQuery Browser Plugin extends browser detection capabilities and 501 | * can assign browser selectors to CSS classes. 502 | * Author: Nate Cavanaugh, Minhchau Dang, Jonathan Neal, & Gregory Waxman 503 | * Updated By: Steven Bower for use with jReject plugin 504 | * Copyright: Copyright (c) 2008 Jonathan Neal under dual MIT/GPL license. 505 | */ 506 | 507 | (function ($) { 508 | $.browserTest = function (a, z) { 509 | var u = 'unknown', 510 | x = 'X', 511 | m = function (r, h) { 512 | for (var i = 0; i < h.length; i = i + 1) { 513 | r = r.replace(h[i][0], h[i][1]); 514 | } 515 | 516 | return r; 517 | }, c = function (i, a, b, c) { 518 | var r = { 519 | name: m((a.exec(i) || [u, u])[1], b) 520 | }; 521 | 522 | // Edge claims to be everything and edge last so we need to test for this after we get the wrong result 523 | if(/edge\//.test(i)) { 524 | r.name = 'edge'; 525 | } 526 | 527 | r[r.name] = true; 528 | 529 | if(r.edge) { 530 | c = /(edge)(:|\/|\s)([a-z0-9\.\+]*?)(\;|dev|rel|\s|$)/; 531 | } 532 | 533 | if (!r.opera) { 534 | r.version = (c.exec(i) || [x, x, x, x])[3]; 535 | } 536 | else { 537 | r.version = window.opera.version(); 538 | } 539 | 540 | if (/safari/.test(r.name)) { 541 | var safariversion = /(safari)(\/|\s)([a-z0-9\.\+]*?)(\;|dev|rel|\s|$)/; 542 | var res = safariversion.exec(i); 543 | if (res && res[3] && res[3] < 400) { 544 | r.version = '2.0'; 545 | } 546 | } 547 | 548 | else if (r.name === 'presto') { 549 | r.version = ($.browser.version > 9.27) ? 'futhark' : 'linear_b'; 550 | } 551 | 552 | if (/msie/.test(r.name) && r.version === x) { 553 | var ieVersion = /rv:(\d+\.\d+)/.exec(i); 554 | r.version = ieVersion[1]; 555 | } 556 | 557 | r.versionNumber = parseFloat(r.version, 10) || 0; 558 | r.versionX = Math.trunc(parseFloat(r.version)) || x; 559 | r.className = r.name + r.versionX; 560 | 561 | return r; 562 | }; 563 | 564 | a = (/Opera|Navigator|Minefield|KHTML|Chrome|CriOS/.test(a) ? m(a, [ 565 | [/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/, ''], 566 | ['Chrome Safari', 'Chrome'], 567 | ['CriOS', 'Chrome'], 568 | ['KHTML', 'Konqueror'], 569 | ['Minefield', 'Firefox'], 570 | ['Navigator', 'Netscape'] 571 | ]) : a).toLowerCase(); 572 | 573 | $.browser = $.extend((!z) ? $.browser : {}, c(a, 574 | /(camino|chrome|crios|firefox|netscape|konqueror|lynx|msie|trident|opera|safari)/, 575 | [ 576 | ['trident', 'msie'] 577 | ], 578 | /(camino|chrome|crios|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|rv|safari)(:|\/|\s)([a-z0-9\.\+]*?)(\;|dev|rel|\s|$)/)); 579 | 580 | $.layout = c(a, /(gecko|konqueror|msie|trident|opera|webkit)/, [ 581 | ['konqueror', 'khtml'], 582 | ['msie', 'trident'], 583 | ['opera', 'presto'] 584 | ], /(applewebkit|rv|konqueror|msie)(\:|\/|\s)([a-z0-9\.]*?)(\;|\)|\s)/); 585 | 586 | $.os = { 587 | name: (/(win|mac|linux|sunos|solaris|iphone|ipad)/. 588 | exec(navigator.platform.toLowerCase()) || [u])[0].replace('sunos', 'solaris') 589 | }; 590 | 591 | if (!z) { 592 | $('html').addClass([$.os.name, $.browser.name, $.browser.className, 593 | $.layout.name, $.layout.className].join(' ')); 594 | } 595 | }; 596 | 597 | $.browserTest(navigator.userAgent); 598 | }(jQuery)); 599 | --------------------------------------------------------------------------------