Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Create Home Screen links to 3rd Party browsers without jailbreaking' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create Home Screen links to 3rd Party browsers without jailbreaking
Authored by: bglnelissen on Mar 09, '11 02:01:24AM
Nice trick, especially the call trick. I thought it was a pain to change the file so i wrote a little PHP to do this in one go. It uses cookies and receives info with the URL. Although it works, it's just a quick hack, URL's do not get encoded etc.

This is what the URL looks like:

index.php?name=John&tel=555-123456789&icon=John-57x57.png&delete=false
You can test is live on my server (medicode.nl/call): "Add John to your phone with one link"

Here is the code. (you need to fix the tags at the HTML section, this markup deletes tags that are forbidden. <-html> (remove minus))


<?php
// made by b.nelissen
// march 2011
// URL encode can be done with PHP or here: http://meyerweb.com/eric/tools/dencoder/
// URL encode plus sign is: %2B

if(	(isset(&#36;_COOKIE[&#36;_GET['name']."name"]))
	&amp;&amp;
	('true'==&#36;_GET['delete'])
){
	// user wants to reset cookie/tel-number
	setcookie(&#36;_GET['name']."tel");
	setcookie(&#36;_GET['name']."name");
	setcookie(&#36;_GET['name']."icon");
	error_to_little_info();
	die();
}

if( (empty(&#36;_COOKIE[&#36;_GET['name']."tel"]))
	||
	(empty(&#36;_COOKIE[&#36;_GET['name']."name"]))
	||
	(empty(&#36;_COOKIE[&#36;_GET['name']."icon"]))
	){
	// check if GET is set.
	if( (isset(&#36;_GET['name']))
		&amp;&amp;
		(isset(&#36;_GET['icon']))
		&amp;&amp;
		(isset(&#36;_GET['tel']))
		){
		// all info is there, create icon
		save_to_homescreen();
	}else{
		// not all info is here, error
		error_to_little_info();
	}
}else{
	// we know the name, icon and number
	// let's call
	header("Location: tel://".&#36;_COOKIE[&#36;_GET['name']."tel"]);
	die();
}

function error_to_little_info(){
	echo("<h1>Error:");
	echo("Sorry but you need to set a name, tel-number and image location:

"); echo("index.php?name=John&tel=555-123456789&icon=John-57x57.png

"); } function save_to_homescreen(){ /* Bogus: if the user does not press the + sign, the cookie is still set. */ $time_to_forget = 60*60*24*365; // 1 year setcookie($_GET['name']."tel", $_GET['tel'], time()+$time_to_forget); setcookie($_GET['name']."name", $_GET['name'], time()+$time_to_forget); setcookie($_GET['name']."icon", $_GET['icon'], time()+$time_to_forget); ?> <-html> <-head> <-link rel="apple-touch-icon-precomposed" href="<?php echo(&#36;_GET['icon']);?>" /> <-title><?php echo(htmlspecialchars(&#36;_GET['name']));?> <-/head> <-body> <-h1><?php echo(htmlspecialchars(&#36;_GET['name']));?><-/h1> <-h2><?php echo(htmlspecialchars(&#36;_GET['tel']));?><-/h2> <-img src="<?php echo(&#36;_GET['icon']);?>"> <-h2>Press + to save this contact to your homescreen.<-/h2> <-/body> <-/html> <?php } ?>

PS. If you make big money using it, i want my share...
Edited on Mar 09, '11 02:07:40AM by bglnelissen


[ Reply to This | # ]