Communication through various social media sites such as Facebook, Twitter and Google+ is becoming a must see on any site, whether it is a static site or a mobile site. Users of any site are more and more aware of the social media and want to have the ability to share what they have read with their friends and family. To do this, they want to be able to press a button or at least have the option of sharing. Considering all of the websites and blogs that there are on the Internet, this is a fairly new concept and something that we should see increasing as days and months go by.
Typically we are used to seeing the Facebook and Twitter buttons on websites. We may see email sharing and Google+ on some sites, but there is something else that might work that would give the website visitors another option. This would be the ability to click on a link that would send you or whomever you wanted to receive it an iMessage. This replacement for the iChat allows direct messaging to occur between various iOS devices such as the iPhone, iPad, iPod Touch and the OS X powered Mac. This option is best used with smaller websites and blogs.
The iMessage Me Link code will find the devices, start the correct URL scheme that will create a new iMessage that contains a particular email address. Listed below are the steps to creating iMessage Me Link code.
Step 1: Create a new PHP file and name it index.php. All of the code will go into one file, but we will explain it in section. In this first section, the code will check the user-agent of the user’s device.
<?php
$useragent = $_SERVER['HTTP_USER_AGENT'];
if (preg_match(‘/Macintosh/’,$useragent)) $os = ‘imessage’;
elseif(preg_match(‘/iPhone/’,$useragent)) $os = ‘sms’;
else $os = ‘sms’;
echo $os;
?>
Step 2: In the next step, what you see is very similar to code created to send a regular email. You can see that HTML has been use to create a link around a text string.
<a href=”PLACEPHPHERE:your@email.com”>iMessage Bloggersethics</a>
Step 3: In the next view, you can see that the HTML and the PHP have been combined so that when someone either clicks on the link or taps on the link, the code will start to detect the user-agent and perform the required URL scheme.
<a href=”<?php
$useragent = $_SERVER['HTTP_USER_AGENT'];
if (preg_match(‘/Macintosh/’,$useragent)) $os = ‘imessage’;
elseif(preg_match(‘/iPhone/’,$useragent)) $os = ‘sms’;
else $os = ‘sms’;
echo $os;
?>:iMessage@bloggersethics.com”>iMessage Bloggersethics!</a>
Step 4: Save the code changes in the index.php file and upload it to the required domain for testing.
One of the great things about using this method is that if the user is not visiting from an iOS 5 compatible device, then it opens a new multimedia message occurrence.
With some CSS styling, the web developer can make this link look appealing and have it look as if it fits into the website. This may be a good way to provide some customer support to your website or blog visitors.
Recent Comments