jQuery open pdf in external window
// open pdf files in new window
$("a[@href$=pdf]").each(function() {
$(this).attr('target', '_blank');
});
Added to JS by Davy Van Den Bremt
jQuery open links in external window
// open links in external window
$("a[@href^=http]").each(function() {
if(this.href.indexOf(location.hostname) == -1) {
$(this).click(function(){window.open(this.href);return false;});
}
});
Added to JS by Davy Van Den Bremt
Add jquery in header
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">google.load("jquery", "1");</script>
Added to JS by Vayu Robins
iPhone/iPod Force Redirect
<script language="javascript">
if (navigator.userAgent.indexOf('iPhone') != -1 ||
navigator.userAgent.indexOf('iPod') != -1) {
window.location = "http://XXXX"
}
</script>
Added to JS by Paul George
Ajax - XMLHtmlRequest with "TOGGLE" effect
<script type="text/javascript">
function script()
{
var e = document.getElementById();
if(e.innerHTML == "")
{
var oRequest;
try {
oRequest=new XMLHttpRequest();
} catch (e) {
try {
oRequest=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
oRequest=new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
alert("AJAX IS NOT SUPPORTED");
return false;
}
}
}
oRequest.onreadystatechange=function() {
if(oRequest.readyState==4)
{
document.getElementById().innerHTML = oRequest.responseText;
}
}
oRequest.open("GET","",true);
oRequest.send(null);
}
else
{e.innerHTML = "";}
}
</script>
Ajax - XMLHtmlRequest
<script type="text/javascript">
function script()
{
var e = document.getElementById("");
var oRequest;
try {
oRequest=new XMLHttpRequest();
} catch (e) {
try {
oRequest=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
oRequest=new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
alert("YOUR BROWSER DOESN'T SUPPORT AJAX!");
return false;
}
}
}
oRequest.onreadystatechange=function() {
if(oRequest.readyState==4)
{
document.getElementById("").innerHTML = oRequest.responseText;
}
}
oRequest.open("GET",,true);
oRequest.send(null);
}
</script>
Unify Div Heights (using jQuery)
// Make the height of all the innerDivs the same height based on the tallest one.
function unifyHeights()
{
var maxHeight = 0;
$('div#OuterContainer').children('div').each(function(){
var height = $(this).outerHeight();
//alert(height);
if ( height > maxHeight ) { maxHeight = height; }
});
$('div.innerDivs').css('height', maxHeight);
}
Added to JS by Michael D. Noga
Get Value of Select and Load external file to div (jQuery)
$(document).ready(function(){
$('#contactFormSelect :selected').val();
$("#contactFormSelect").change(function(){
$('#formLoader').load($('#contactFormSelect').val());
});
});
Added to JS by Mark Evans