Hi,
I am using .net api to access WURFL cloud service. How do I disable caching through code? There is no api method for that.
Regards
Nitin
Disable caching through code
-
- Posts: 294
- Joined: Mon Jun 20, 2011 5:04 pm
Re: Disable caching through code
Can you expand on why you would like to disable caching?
thanks
thanks
-
- Posts: 2
- Joined: Tue Dec 04, 2012 8:16 am
Re: Disable caching through code
Two reasons:
Changing of capabilities is not reflected until the browser cache is cleared. Currently I am testing my code but I cant ask people who want to test it to clear browser cache every time I add/remove capabilities.
Another reason is that when the code is made live and some capabilities are added or removed then I cant ask existing users of my web app to clear browser cache.
There should be some way in which the cache is cleared whenever there is any change in capabilities and this should be handled by the API
Changing of capabilities is not reflected until the browser cache is cleared. Currently I am testing my code but I cant ask people who want to test it to clear browser cache every time I add/remove capabilities.
Another reason is that when the code is made live and some capabilities are added or removed then I cant ask existing users of my web app to clear browser cache.
There should be some way in which the cache is cleared whenever there is any change in capabilities and this should be handled by the API
-
- Posts: 7
- Joined: Fri Jul 05, 2013 10:44 am
Re: Disable caching through code
Im facing the same problem upon changing the capabilties my methods are still returning the old values so would like someway of clearing the cache
Re: Disable caching through code
Preventing the Browser From Caching
If you generate HTML code from your PHP script, you should probably also mark the generated code as something that your visitor's browser should not cache. Otherwise, the next time the visitor invokes "sendmail.php" directly, he/she might see your error page instead of being redirected to your feedback form.
To invalidate the cache in your visitor's browser, modify the above script as follows:
The PHP script outputs some HTTP headers to the browser in an attempt to force browsers and proxies not to cache the page. Since there isn't a common HTTP header that will work with every single browser and proxy out there, the script tries to cover as many bases as it can by issuing a variety of headers.
Remember that all HTTP headers must be sent to the browser before any HTML code is generated. As such, if your script needs to issue HTTP headers (using the header function), make sure that you start the script with "<?php" and only generate HTML code after any HTTP headers have been sent. If your script starts with HTML code you will not be able to use the header function without receiving an error.
source::
http://www.thesitewizard.com/archive/phptutorial2.shtml
If you generate HTML code from your PHP script, you should probably also mark the generated code as something that your visitor's browser should not cache. Otherwise, the next time the visitor invokes "sendmail.php" directly, he/she might see your error page instead of being redirected to your feedback form.
To invalidate the cache in your visitor's browser, modify the above script as follows:
Code: Select all
elseif (empty($email) || empty($message)) {
header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header( "Cache-Control: no-cache, must-revalidate" );
header( "Pragma: no-cache" );
?>
<html>
<head><title>Error</title></head>
<body>
<h1>Error</h1>
<p>
Oops, it appears you forgot to enter either your
email address or your message. Please press the BACK
button in your browser and try again.
</p>
</body>
</html>
<?php
[...etc...]
Remember that all HTTP headers must be sent to the browser before any HTML code is generated. As such, if your script needs to issue HTTP headers (using the header function), make sure that you start the script with "<?php" and only generate HTML code after any HTTP headers have been sent. If your script starts with HTML code you will not be able to use the header function without receiving an error.
source::
http://www.thesitewizard.com/archive/phptutorial2.shtml
Who is online
Users browsing this forum: No registered users and 5 guests