HTML meta http-equiv not showing up - html

I'm a little bit confused, because the HTTP header I'm trying to set is not showing up when I try to inspect the HTTP response headers with curl or Chromes developer tools.
I set the following header(s):
<html>
<head>
<meta http-equiv="set-cookie" content="the_name=some_value; path=/" />
</head>
<body>
<p>Hello World.</p>
</body>
</html>
I also tried to set the following header:
<meta http-equiv="refresh" content="2;URL=http://www.example.com" />
If I set a header with PHP, it shows up:
<head>
<?php header("refresh:2; URL=site.php"); ?>
</head>
Why do the HTTP headers I try to set via HTML do not show up with curl -I or with Chrome's developer tools, what am I doing wrong?

http-equiv tries to be equivalent to an HTTP header, it is not a way to set a real HTTP header.
Since it isn't a real HTTP header so won't show up if you look at the real HTTP headers.
It isn't really equivalent, there are many limitations
set-cookie is not a valid value for http-equiv

I don't have the tools to try this out at this second, but try changing the end of the tags to the proper version.
XML:
" />
HTML:
">

Related

HTML image - mime-type

I was looking into MIME types and there is something I don't understand yet.
I want to display a Base64 image in my page body.
I know this example works:
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAM0AAAD
NCAMAAAAsYgRbAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5c
cllPAAAABJQTFRF3NSmzMewPxIG//ncJEJsldTou1jHgAAAARBJREFUeNrs2EEK
gCAQBVDLuv+V20dENbMY831wKz4Y/VHb/5RGQ0NDQ0NDQ0NDQ0NDQ0NDQ
0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0PzMWtyaGhoaGhoaGhoaGhoaGhoxtb0QGho
aGhoaGhoaGhoaGhoaMbRLEvv50VTQ9OTQ5OpyZ01GpM2g0bfmDQaL7S+ofFC6x
v3ZpxJiywakzbvd9r3RWPS9I2+MWk0+kbf0Hih9Y17U0nTHibrDDQ0NDQ0NDQ0
NDQ0NDQ0NTXbRSL/AK72o6GhoaGhoRlL8951vwsNDQ0NDQ1NDc0WyHtDTEhD
Q0NDQ0NTS5MdGhoaGhoaGhoaGhoaGhoaGhoaGhoaGposzSHAAErMwwQ2HwRQ
AAAAAElFTkSuQmCC" alt="beastie.png">
I am wondering, can I also achieve it with something like this?
<head>
<meta http-equiv="content-type" content="image/png;">
</head>
<body>
<img src="iVBORw0KGgoAAAANSUhEUgAAAM0AAAD
NCAMAAAAsYgRbAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5c
cllPAAAABJQTFRF3NSmzMewPxIG//ncJEJsldTou1jHgAAAARBJREFUeNrs2EEK
gCAQBVDLuv+V20dENbMY831wKz4Y/VHb/5RGQ0NDQ0NDQ0NDQ0NDQ0NDQ
0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0PzMWtyaGhoaGhoaGhoaGhoaGhoxtb0QGho
aGhoaGhoaGhoaGhoaMbRLEvv50VTQ9OTQ5OpyZ01GpM2g0bfmDQaL7S+ofFC6x
v3ZpxJiywakzbvd9r3RWPS9I2+MWk0+kbf0Hih9Y17U0nTHibrDDQ0NDQ0NDQ0
NDQ0NDQ0NTXbRSL/AK72o6GhoaGhoRlL8951vwsNDQ0NDQ1NDc0WyHtDTEhD
Q0NDQ0NTS5MdGhoaGhoaGhoaGhoaGhoaGhoaGhoaGposzSHAAErMwwQ2HwRQ
AAAAAElFTkSuQmCC" alt="beastie.png"> </body>
No.
<meta http-equiv="content-type" content="image/png;"> describes (poorly) the content-type for the HTML document.
src="iVBORw0KG etc etc is a relative URL that will be fetched over whatever scheme (usually HTTP) was used to fetch the HTML document.
If you want to switch schemes (which you need to do for a data: URI) then you need an absolute URI.
(That simplifies slightly. Scheme relative URIs do exist, but don't help with your problem.)

how to retrieve URL into GSP

i am trying to show a content in iframe..it works at localhost
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><g:message code="default.list.label" args="[entityName]"/></title>
</head>
<body>
<div class="body">
<iframe style="width: 100%;min-height: 400px;height: 600px" src="https://www.google.com" />
</div>
</body>
</html>
but when i build a war and deploy it to server...that page was blank?
why?
Because Facebook doesn't allow it:
curl -v https://www.facebook.com
...
< X-Frame-Options: DENY
...
With DENY value:
The page cannot be displayed in a frame, regardless of the site
attempting to do so.
Google and many other sites have similar configuration, so please check for header. Also, you could open Chrome Developer Console, and check for errors
See docs for this header: https://developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header

Does html charset apply to the markup or the content or both?

I'm wondering if something like this:
Content-Type: text/html; charset=<some encoding>
means that the markup tags are also in <some encoding> or if it only refers to the content.
Full example:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Super_Awesome_Encoding">
</head>
<body>
Some content!
</body>
</html>
Are the markup tags <html>, <body>, etc encoded as Super_Awesome_Encoding or just the string "Some content!" ?
Is there a difference if the charset is set via an http header such as:
Content-Type: text/html; charset=Super_Awesome_Encoding
?
It refers to the entire file (note that it is a claim and that it is possible for the actual encoding to differ, this is likely to lead to undesired effects).

How to iframe craigslist.org

Can someone explain why iframe works in Firefox but does not work in Internet Explorer.
I'm trying to iframe www.craigslist.org with no luck.
why not use a <div> then set the innerHTML to CONTENTS OF craiglist.org?
Check headers returned by the site and you'll see the site simply refuses rendering inside of IFrames on other sites. Probably version of Firefox you are using does not support the header or more likely site's format of the header incorrectly makes it ignored by Firefox.
X-Frame-Options: Allow-From https://forums.craigslist.org
Info - X-Frame-Options
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head> <title>Craigslist Frame</title>
<base href="http://craiglist.org" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<div>
<?php
$url = "http://www.craiglist.org/";
$string= file_get_contents($url);
echo $string;
?>
</div>
</body>
</html>
Try this out :-)

How to clear HTML content already sent to the browser, without JavaScript?

Bugzilla, Mozilla's issue tracker, has a nice loading screen while the search is being executed. In the days of Ajax, this is nothing special. They do it without any scripting, though, and I want to know how.
For example:
Disable JavaScript
Open the following URL: https://bugzilla.mozilla.org/buglist.cgi?short_desc=IDL&resolution=---&resolution=DUPLICATE&query_format=advanced&short_desc_type=allwordssubstr
You get a page with an animated image, the text "Please wait while your bugs are retrieved." and a title of "Bugzilla is pondering your search".
Update:
This is the entire DOM while the search is being executed. No meta refresh, no scripts.
<html>
<head>
<title>Bugzilla is pondering your search</title>
</head>
<body>
<div style="margin-top: 15%; text-align: center;">
<center>
<img width="160" height="87" alt=""
src="extensions/BMO/web/images/mozchomp.gif">
</center>
<h1>Please wait while your bugs are retrieved.</h1>
</div>
</body>
</html>
After a while, the results page appears. The previous HTML vanishes and a completely new DOM appears, including a new title "Bug List".
So my question is: how does this work exactly? Please don't list alternative techniques - I am not interested in loading screens at all, but want to use that exact mechanism for something completely different.
if you look at the souce of the page you see you actually get two responses each with its own header
WARNING: YOUR BROWSER DOESN'T SUPPORT THIS SERVER-PUSH TECHNOLOGY.
--------- =_y97AELt1tHMqcK8D
Content-Type: text/html; charset=UTF-8
<html>
<head>
<title>Bugzilla is pondering your search</title>
</head>
<body>
<div style="margin-top: 15%; text-align: center;">
<center><img src="extensions/BMO/web/images/mozchomp.gif" alt=""
width="160" height="87"></center>
<h1>Please wait while your bugs are retrieved.</h1>
</div>
</body>
</html>
--------- =_y97AELt1tHMqcK8D
Content-Type: text/html; charset=UTF-8
content-disposition: inline; filename="bugs-2011-08-30.html"
Set-Cookie: {data}
Set-Cookie: {data}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Bug List</title>
{the rest of the request}
I'm not too sure about the browser support for this except for mozilla...
Use a meta refresh tag to reload the page every N seconds.
Return the "please wait page" (with the meta tag) as long as the search results are collected.
Return the results page (without the meta tag) when the results are ready.
You should be able to see what is happening when you open Firebug (or similar) and open the Network tab.