Ipad detection with PHP and htaccess
Posted on Thursday 19 August 2010
This wil return a 1 value if it’s an iPad:
$ipad_or_not = (bool) strpos($_SERVER[‘HTTP_USER_AGENT’],‘iPad’);
You also can redirect with htaccess:
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^.*iPad.*$
RewriteRule ^(.*)$ http://ipad.yourdomain.com [R=301]
Deselect all options in dropdown with jQuery
Posted on Monday 7 June 2010
Here's how you deselect all the values in a dropdown with jQuery
$("#dropdown").each(function(){
$("#dropdown").removeAttr("selected");
});
Most used Social media share links (facebook, twitter, linkedin, Stuble upon)
Posted on Saturday 22 May 2010
As sharing content with other people becomes more and more common in every day web development I mainly just use these share links. I always seem to forget how to form them, so here they are:
FACEBOOK
http://www.facebook.com/sharer.php?u=http://stevendobbelaere.be&t=test
TWITTER
http:/twitter.com/home?status=Currently reading http://stevendobbelaere.be
LINKEDIN
http://www.linkedin.com/shareArticle?summary=Web development blog&title=Currently reading http://stevendobbelaere.be&mini=true&url=http://stevendobbelaere.be&source=http://stevendobbelaere.be
STUMBLE UPON
http://www.stumbleupon.com/submit?url=http://www.stevendobbelaere.be&title=Steven+dobbelaere
MAILTO
mailto:info@stevendobbelaere.be?subject=this is the subject&body=this is the body
Easily embed Flash movies and make them viewable fullscreen with jQuery and SWFobject
Posted on Wednesday 27 January 2010
I wrote a little jQuery script that makes embedding flash movies very easy and makes them go fullscreen when you click a link. I used jQuery swfobject to load in the movies and jQuery to make it go fullscreen. I import the flash videos in a div and set the div’s width and height to 100%. This flash div is outside of a container div. When I make the flash div go fullscreen, I set the display of the container div to none.
Supported browsers:
Internet Explorer 5.5/6.0/7.0/8.0
FireFox 1.5/2.0
Safari 2.0
Opera 9.0
Generate content with CSS before or after an element
Posted on Saturday 23 January 2010
You can easily add content before or after an element . To do so the content property is used with the :before and :after pseudo-elements, to insert generated content.It’s only supposed to work only for the :before and :after pseudo-elements, but only Opera and Konqueror appear to support this. Safari and Chrome support content without the pseudo elements for images, but not for text. And for Internet Explorer, only IE8 supports the content property. For more information on the browser support for this CSS property -> http://www.quirksmode.org/css/contents.html
For example, the following rule inserts the string “Description: ” before the content of every P element whose “class” attribute has the value “descr”:
p.descr:before {
content: "Description: "
}
The following example inserts the URL in parenthesis after each link:
a:after {
content: " (" attr(href) ")";
}
this results in a URL like this on your webpage:
test (“http://www.test.com”)
Force break instead of paragraph on new lines in Tiny_mce
Posted on Friday 22 January 2010
Normally tiny_mce inserts a new paragraph when you hit return. You can make tiny_mce force a BR element on newlines instead of inserting a new paragraph. Normally you should utilize P tags instead of BR, so only use this when you have to!
Usage:
tinyMCE.init({
force_br_newlines : true,
...
});