The page I am working on has a javascript function executed to print parts of the page. For some reason, printing in Safari, causes the window to somehow update. I say somehow, because it does not really refresh as in reload the page, but rather it starts the "rendering" of the page from start, i.e. scroll to top, flash animations start from 0, and so forth. The effect is reproduced by this fiddle: http://jsfiddle.net/fYmnB/ Clicking the print button and finishing or cancelling a print in Safari causes the screen to "go white" for a sec, which in my real website manifests itself as something "like" a reload. While running print button with, let's say, Firefox, just opens and closes the print dialogue without affecting the fiddle page in any way. Is there something with my way of calling the browsers print method that causes this, or how can it be explained - and preferably, avoided? P.S.: On my real site the same occurs with Chrome. In the ex
Im using my PHP-Webservice this way:
ReplyDeleteJava:
// params => "?action=getInfos"
private JSONObject getJSONObject(String params)
{
try
{
String url = path2webservicephp + params;
System.out.println("Call URL: " + url);
HttpGet request = new HttpGet(url);
request.setHeader("Content-Type", "text/xml;charset=UTF-8");
DefaultHttpClient httpclient2 = new DefaultHttpClient();
HttpResponse response = httpclient2.execute(request);
if (response.getStatusLine().getStatusCode() != 200)
throw new ConnectionException("Status Code is " + response.getStatusLine().getStatusCode() + ": " + response.getStatusLine().getReasonPhrase());
BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), "UTF-8"));
String line = reader.readLine();
MyConstants.RECEIVEDBYTES += line.length();
reader.close();
if ("[]".equals(line))
return null;
return new JSONObject(line);
}
catch (Exception e)
{
LLog.e(Webservice.class, "Exception! params: " + params);
LLog.e(e, Webservice.class);
}
return null;
}
// LLog.e is from my own class. It logs to Log.e and into a file
PHP:
$array = array('status' => 'ok', 'message' => 'your action was: '.$_GET['action']);
echo json_encode($array);