How to detect a browser iPhone ?
Mozilla/5.0 (iPhone; U; CPU like Mac OS X; fr) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3B48b Safari/419.3
Source: ab-d.fr
Internet with iPhone
12551 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Benoit Asselin http://www.ab-d.fr
Mozilla/5.0 (iPhone; U; CPU like Mac OS X; fr) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3B48b Safari/419.3
... mysql_query( "SET NAMES 'utf8' " ); ...
function f_magic_quotes($text) { if ( !get_magic_quotes_gpc() ) { return addslashes($text); } else { return $text; } }
function f_clean_quotes($text) { if ( !get_magic_quotes_gpc() ) { return $text; } else { return stripslashes($text); } }
<?php ${'New variable text'} = 'This is a new variable text.'; echo ${'New variable text'}; // This is a new variable text. ?>
Array.prototype.in_array = function(p_val) { for(var i = 0, l = this.length; i < l; i++) { if(this[i] == p_val) { return true; } } return false; }
var v_array = [ 5, 10, 15, 20, 25]; document.writeln(v_array.in_array(10)); // true document.writeln(v_array.in_array(11)); // false
function includeCSS(p_file) { var v_css = document.createElement('link'); v_css.rel = 'stylesheet' v_css.type = 'text/css'; v_css.href = p_file; document.getElementsByTagName('head')[0].appendChild(v_css); }
<textarea cols="30" rows="10" style="resize: both;">www.AB-D.fr presents the new TEXTAREA</textarea> <textarea cols="30" rows="10" style="resize: horizontal;">www.AB-D.fr presents the new TEXTAREA</textarea> <textarea cols="30" rows="10" style="resize: vertical;">www.AB-D.fr presents the new TEXTAREA</textarea> <textarea cols="30" rows="10" style="resize: none;">www.AB-D.fr presents the new TEXTAREA</textarea>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" version="-//W3C//DTD XHTML 1.1//EN" xml:lang="fr"> <head> <title>.setAttribute('style','');</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript"> <!-- window.onload = function() { if (navigator.appName == 'Microsoft Internet Explorer') { document.getElementById('test').style.cssText = 'background:gray; color:white;'; } else { /* document.getElementById('test').style.cssText = 'background:gray; color:white;'; */ document.getElementById('test').setAttribute('style', 'background:gray; color:white;'); } } --> </script> </head> <body> <div id="test">document.getElementById('test').setAttribute('style', 'background:gray; color:white;')</div> </body> </html>
<a href="http://www.google.com/" onclick="window.open(this.href); return false;">Link</a>
if (window.widget) { widget.setPreferenceForKey(value, 'myKey'); }
if (window.widget) { if (!(widget.preferenceForKey('myKey') === undefined)) { var myKey = widget.preferenceForKey('myKey'); } }