Last active
August 29, 2015 14:01
-
-
Save mrg/ba7395fa89a48a4c423d to your computer and use it in GitHub Desktop.
Tapestry 5(.4) component to warn users if they are using an old version of IE which probably will not work well.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A simple Tapestry 5.4 + Bootstrap Alert component to warn users they | |
shouldn't be using older versions of IE. | |
Note: This requires the UserAgent service: | |
https://gist.github.com/mrg/b814a42d86597440c9d9 | |
To use, simply include it in your page TML somewhere, perhaps in your | |
Layout component for best results: | |
<t:ieWarning/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Put this in your src/main/java/.../components folder: | |
import ....services.UserAgent; | |
import org.apache.tapestry5.annotations.Import; | |
import org.apache.tapestry5.annotations.Property; | |
import org.apache.tapestry5.ioc.annotations.Inject; | |
@Import(module = { "bootstrap/alert" }) | |
public class IEWarning | |
{ | |
@Inject | |
@Property | |
private UserAgent userAgent; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Put this in your src/main/resources/.../components folder: | |
<!DOCTYPE html> | |
<t:container xmlns="http://www.w3.org/1999/xhtml" | |
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" | |
xmlns:p="tapestry:parameter"> | |
<div t:type="if" t:test="userAgent.badIE" class="alert alert-danger fade in"> | |
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> | |
<h4>Did you know your Internet Explorer is out-of-date?</h4> | |
<p>This site <b>may not work well or may not function correctly</b> unless you upgrade to a newer, more modern browser.</p> | |
<p>We recommend using: IE 9+, Firefox, Chrome, or Safari.</p> | |
</div> | |
</t:container> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment