- Joined
- Jan 5, 2005
I wrote a small page to grab a few websites I read from their rss feeds and show them in an iphone friendly page. It uses ajax to update via a php script. It has always worked no problems, but all of a sudden it stopped working on my iphone. I checked with firefox on my desktop, and the page works perfectly fine. Any ideas?
I turn on the developer thing in safari, and it shows 0 errors. When I click the links, nothing happens at all.
I turn on the developer thing in safari, and it shows 0 errors. When I click the links, nothing happens at all.
Code:
<html>
<head>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta name="format-detection" content="telephone=no" />
<meta content="yes" name="apple-mobile-web-app-capable" />
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>iPhone Syndication Reader</title>
<script language="JavaScript" type="text/javascript">
var xmlHttp;
var current_synd;
var pos=0;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
}
}
}
function showOverlay(height)
{
document.getElementById("overlay").style.top = height;
document.getElementById("overlay").style.display = "block";
}
function hideOverlay()
{
document.getElementById("overlay").style.display = "none";
}
function get_synd(synd,inputObj,xmlHttp)
{
current_synd = synd;
showOverlay("50px");
xmlHttp.onreadystatechange=function()
{
if( xmlHttp.readyState==4 )
{
inputObj.innerHTML = xmlHttp.responseText;
document.getElementById("loadmore").style.display = "block";
hideOverlay();
window.scrollTo(0,1);
pos = 1;
}
}
str_fcode = "a=" + encodeURIComponent(synd) + "&pos=0";
xmlHttp.open("POST","synd.php",true);
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", str_fcode.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(str_fcode);
}
function add_synd(inputObj,xmlHttp)
{
showOverlay((window.scrollY + 50) + "px");
xmlHttp.onreadystatechange=function()
{
if( xmlHttp.readyState==4 )
{
inputObj.innerHTML += xmlHttp.responseText;
hideOverlay();
}
}
str_fcode = "a=" + encodeURIComponent(current_synd) + "&pos=" + pos;
pos++;
xmlHttp.open("POST","synd.php",true);
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", str_fcode.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(str_fcode);
}
</script>
<script type="text/javascript">
addEventListener(
"load",
function() {
setTimeout(load_stuff, 0);
}, false
);
function load_stuff() {
get_synd('fml',document.getElementById('synd'),xmlHttp);
window.scrollTo(0,1);
}
</script>
<link rel="stylesheet" media="screen" type="text/css" href="synd.css" />
</head>
<body>
<div id="overlay" align="center" class="overlaybg" style="display: none">Loading...</div>
<div class="menu">
<ul>
<li><a href="javascript:get_synd('fml',document.getElementById('synd'),xmlHttp)">FML</a></li>
<li><a href="javascript:get_synd('tfln',document.getElementById('synd'),xmlHttp)">TFLN</a></li>
<li><a href="javascript:get_synd('xkcd',document.getElementById('synd'),xmlHttp)">xkcd</a></li>
<li><a href="javascript:get_synd('ch',document.getElementById('synd'),xmlHttp)">C&H</a></li>
</ul>
</div>
<div style=" text-align:left;" id="index" selected="true">
<div id="synd">
</div>
<div class="menu" id="loadmore" style="display: none">
<ul>
<li><a style="width:100%;" href="javascript:add_synd(document.getElementById('synd'),xmlHttp)">Load More...</a></li>
</ul>
</div>
</div>
</body>
</html>
Last edited: