Thursday, May 16, 2019
Tuesday, July 8, 2014
html 5 video tag.
<video width='320' height='240' controls autoplay>
<source src='http://someurl/video.mp4' type='video/mp4'>
<source src='http://someurl/video.ogg' type='video/ogg'>
<source src='http://someurl/video.webm' type='video/webm'>
<object data='movie.mp4' width='320' height='240'>
<embed width='320' height='240' src='movie.swf'>
</object>
</video>
Wednesday, November 20, 2013
Ajax Loader, $.getJSON Loader,
Just copy Paste on ur Script top,
It defines globally so no need add again and again for ajax events. It will fire for the jQuery Ajax events.
var cssOverlayOption = {
"position": "fixed",
"top": 0,
"left": 0,
"width": "100%",
"height": "100%",
"background-color": "#000",
"filter":"alpha(opacity=50)",
"-moz-opacity":"0.5",
"-khtml-opacity": "0.5",
"opacity": "0.5",
"z-index": 10000
};
var loaderImageCenter = {
"position":"relative",
"top":"50%",
"left":"50%"
};
var overlay = jQuery('<div id="overlay"><img src="images.jpg" id="loaderImage" width="99" height="102" title="Loading..." align="middle" /> </div>');
overlay.appendTo(document.body);
$(document).ajaxStart(function() {
$("#loaderImage").css(loaderImageCenter);
$("#overlay").css(cssOverlayOption).show();
});
It defines globally so no need add again and again for ajax events. It will fire for the jQuery Ajax events.
var cssOverlayOption = {
"position": "fixed",
"top": 0,
"left": 0,
"width": "100%",
"height": "100%",
"background-color": "#000",
"filter":"alpha(opacity=50)",
"-moz-opacity":"0.5",
"-khtml-opacity": "0.5",
"opacity": "0.5",
"z-index": 10000
};
var loaderImageCenter = {
"position":"relative",
"top":"50%",
"left":"50%"
};
var overlay = jQuery('<div id="overlay"><img src="images.jpg" id="loaderImage" width="99" height="102" title="Loading..." align="middle" /> </div>');
overlay.appendTo(document.body);
$(document).ajaxStart(function() {
$("#loaderImage").css(loaderImageCenter);
$("#overlay").css(cssOverlayOption).show();
});
Sunday, June 23, 2013
Detect Browser in php, User agent detection in php
function detect_mobile()
{
if(preg_match('/(alcatel|amoi|android|avantgo|blackberry|benq|cell|cricket|docomo|elaine|htc|iemobile|iphone|ipad|ipaq|ipod|j2me|java|midp|mini|mmp|mobi|motorola|nec-|nokia|palm|panasonic|philips|phone|playbook|sagem|sharp|sie-|silk|smartphone|sony|symbian|t-mobile|telus|up\.browser|up\.link|vodafone|wap|webos|wireless|xda|xoom|zte)/i', $_SERVER['HTTP_USER_AGENT']))
return true;
else
return false;
}
$mobile = detect_mobile();
if($mobile === true)
{
header("location:mobiledevice/index.php");
}
else
{
echo '<h3>you are looking via system browser</h3>';
/*echo $_SERVER['HTTP_USER_AGENT'];*/
}
{
if(preg_match('/(alcatel|amoi|android|avantgo|blackberry|benq|cell|cricket|docomo|elaine|htc|iemobile|iphone|ipad|ipaq|ipod|j2me|java|midp|mini|mmp|mobi|motorola|nec-|nokia|palm|panasonic|philips|phone|playbook|sagem|sharp|sie-|silk|smartphone|sony|symbian|t-mobile|telus|up\.browser|up\.link|vodafone|wap|webos|wireless|xda|xoom|zte)/i', $_SERVER['HTTP_USER_AGENT']))
return true;
else
return false;
}
$mobile = detect_mobile();
if($mobile === true)
{
header("location:mobiledevice/index.php");
}
else
{
echo '<h3>you are looking via system browser</h3>';
/*echo $_SERVER['HTTP_USER_AGENT'];*/
}
Detect Browser in Javascript, User agent detection in Javascript
<script type="text/javascript">
var ismobile = navigator.userAgent.match(/(alcatel) | (amoi) | (android) | (avantgo) | (blackberry) | (benq) | (cell) | (cricket) | (docomo) | (elaine) | (htc) | (iemobile) | (iPhone) | (ipad) | (ipaq) | (ipod) | (j2me) | (java) | (midp) | (mini) | (mmp) | (mobi) | (motorola) | (nec-) | (nokia) | (palm) | (panasonic) | (philips) | (phone) | (playbook) | (sagem) | (sharp) | (sie-) | (silk) | (smartphone) | (sony) | (symbian) | (t-mobile) | (telus) | (vodafone) | (wap) | (webos) | (wireless) | (xda) | (xoom) | (zte)/i);
if(ismobile)
{
// window.location = 'https://www.google.com.my';
alert("You are using mobile");
}
else
{
// window.location = 'https://www.yahoo.com';
alert("You are using system");
}
</script>
var ismobile = navigator.userAgent.match(/(alcatel) | (amoi) | (android) | (avantgo) | (blackberry) | (benq) | (cell) | (cricket) | (docomo) | (elaine) | (htc) | (iemobile) | (iPhone) | (ipad) | (ipaq) | (ipod) | (j2me) | (java) | (midp) | (mini) | (mmp) | (mobi) | (motorola) | (nec-) | (nokia) | (palm) | (panasonic) | (philips) | (phone) | (playbook) | (sagem) | (sharp) | (sie-) | (silk) | (smartphone) | (sony) | (symbian) | (t-mobile) | (telus) | (vodafone) | (wap) | (webos) | (wireless) | (xda) | (xoom) | (zte)/i);
if(ismobile)
{
// window.location = 'https://www.google.com.my';
alert("You are using mobile");
}
else
{
// window.location = 'https://www.yahoo.com';
alert("You are using system");
}
</script>
Subscribe to:
Posts (Atom)