Strange HTML as result of NSURLConnection request - html

I have a strange problem...
I need to send a GET HTTP Request to web site by NSURLConnection ([NSURLConnection sendAsynchronousRequest...).
All works very well but sometimes I see a strange html result different from what I expect.
This garbage html is this:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<!-- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> -->
<HTML><HEAD><META HTTP-EQUIV="Refresh" CONTENT="0.1">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<TITLE></TITLE></HEAD><BODY><P></BODY>
</HTML>
(Lines split for clarity)
What does that mean?
The web site to which I refer is not mine so I can not work on the server side to solve the issue.
Can I do anything to prevent this?

For some reason, the server (or an intermediary, like a load balancer) is asking you to make the request again in .1 seconds.
If you viewed this page with a web browser, it would wait .1 seconds, and then refresh the page (the purpose of the Refresh meta tag).
You will probably need to check explicitly for this, and retry your request (after waiting .1 seconds to be polite) when it happens.

Related

Why max-age is ignored?

I have a simple html page which starts like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Cache-Control" content="public, must-revalidate">
<meta http-equiv="Cache-Control" content="max-age=88000" />
<script type="text/javascript" src="/js/index.js"></script>
....
However, when I check index.js file in FF web console, I see Cache-Control: "max-age=0". Why is that and how can I fix it? Thanks!
There is no reason to expect a meta tag in an HTML file to affect the HTTP headers sent for a JavaScript file that it refers to (or even the HTTP headers sent for the HTML file itself, for that matter).
The HTTP headers are set by the web server (or, more generally, HTTP server) software in use, possibly as affected by system-wide or directory-wide settings on the server. Long ago, the idea was that certain meta tags might affect the HTTP headers for the HTML document itself, but this was generally not implemented in servers. Instead, browsers may use some meta tags and act as if corresponding HTTP headers had been sent, but a) this only applies to the HTML document itself, if at all and b) it cannot be seen by tools that inspect the HTTP headers actually sent.

FB Thinks Meta Tags Are in Body

If you follow this links you will see that there is a paragraph-tag that should not be there in line 3
This is the actual code that "causes" this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
I do not get why there would be a paragraph-Tag cancelling the element and making FB believe that meta-tags are in the body instead... do you?
https://developers.facebook.com/tools/debug/
I used the Facebook Open Graph Debugger to solve the issue. On the very bottom there is a link called
Scraped URL See exactly what our scraper sees for your URL
This shows exactly what Facebook catches as code and there was a print of a paragraph-tag from one of the libraries I have been using. I can only recommend to debug it this way because I wasted a lot of time not doing so (because I did not see the link at the bottom of the page).

My doctype code is not showing up?

I have two doctypes above my <html> tag and I still don't see it in my page source. I tried just using one of them but they still dont work. Here is the site URL http://nonudot.io-web.com/demo.aspx and the doc types I'm using:
<!DOCTYPE HTML>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Heres a link to a screenshot of the code http://nonudot.io-web.com/LCValleyADA/media/ProjectsContent/Capture.JPG
Thanks
Your screenshot doesn't look anything like the final output. Compare the following
with
Notice how the meta tag <meta http-equiv="pragma" content="no-cache" /> doesn't exist in the second screen grab (my screen grab from your posted site)? That's most likely because your not using the same page... I'm assuming that you might not be using the correct MASTERPAGE, or something has gone awry with your masterpages.
Your style sheets don't match up either.

Chrome and Nginx: strange things happen. Sometimes empty HTML page instead of PHP or static files

On server: nginx with php-fpm and static folder.
On client: Chrome with tab opened for a long time.
Sometimes empty HTML page is retrived instead of PHP or static file. Ajax and non-ajax queries are affected. I can see wrong answers in Network panel:
It's not completely blank page, it's well-formatted page with doctype and head:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<!-- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"> -->
<HTML>
<HEAD>
<META HTTP-EQUIV="Refresh" CONTENT="0.1">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<TITLE></TITLE>
</HEAD>
<BODY><P></BODY>
</HTML>
One time it happened with js-file query, Chrome showed javascript syntax error.
What can it be?

Firefox doesn't show my CSS

I have a strange problem, Firefox 3.6.3 doesn't show the CSS of the page I'm doing, but Internet Explorer 8 does.
I have tried at home and at one of my friend's home, and it happens in both. But, if I go to the Firefox Web Developer toolbar (i have it installed) and select CSS=>Edit CSS, then the styles appears appears in the page and in the editor! As soon I close it, they disappears again. I have no idea what the problem is :(
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Students</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
I've validated my two css files with the W3C CSS validator and there are no problems.
Do you have any idea about what could be the problem?
thanks in advance.
I'll bet a beer that the CSS file is not sending the content-type: text/css header. This causes style sheets to not work in Firefox. IE will ignore the content type.
If this is the reason, you should get a warning in the Firefox error console. You can use Firebug's net tab to verify the content-type sent.
As to why the content type isn't sent, this would be a server issue I think. It usually happens when the CSS file is a .php or .asp file that doesn't get assigned the correct content type automatically by the server when delivering.
Navigate to your css file directly in Firefox (http://www.yoursite.com/style.css) and look at your Page Info (Tools >> Page Info).
If the css file is being submitted as text/html, it's an incorrect MIME type (should be text/css) and you will need to contact your server/host administrator to fix this for you if you don't have access to that.