Crossing Browser

C

Cricca

I want use the "Crossing Browser" technical for create a website for solve
some different behavior between the browsers.
I have searched news in internet and I find this page
http://www.dozarte.com/wordpress/20...-diversi-firefox-internet-explorer-7-e-ie-60/

For try some experiment I have create a sample page with this code

<html>
<head>
<title>Crissing Browser</title>
</head>
<body>
<!--[if IE]>
I am Internet Explorer
<![endif]-->
<!--[if 'Gecko']>
I am Mozilla Firefox
<![endif]-->
<!--[if Opera]>
I am Opera
<![endif]-->
<!--[if chrome]>
I am Google Chrome
<![endif]-->
<!--[if Webkit]>
I am Safari
<![endif]-->
</body>
</html>

If I open the page with Internet Explorer, all is ok, but with the other
browsers the page open is all blank.

Where is my errore?
Someone can help me?

Tanks
Cricca
 
J

Jukka K. Korpela

I want use the "Crossing Browser" technical for create a website for solve
some different behavior between the browsers.

Stop wanting that. Find out the problems and fix them. And as far as
it's just a little different rendering, stop seeing it as a problem.
<!--[if 'Gecko']>
I am Mozilla Firefox
<![endif]-->

How did you make that up? The silly "conditional comments" thing is an
IE oddity, and you can't extend it to other browsers just by throwing
their names into it.
 
G

Gus Richter

I want use the "Crossing Browser" technical for create a website for solve
some different behavior between the browsers.
I have searched news in internet and I find this page
http://www.dozarte.com/wordpress/20...-diversi-firefox-internet-explorer-7-e-ie-60/

For try some experiment I have create a sample page with this code

<html>
<head>
<title>Crissing Browser</title>
</head>
<body>
<!--[if IE]>
I am Internet Explorer
<![endif]-->
<!--[if 'Gecko']>
I am Mozilla Firefox
<![endif]-->
<!--[if Opera]>
I am Opera
<![endif]-->
<!--[if chrome]>
I am Google Chrome
<![endif]-->
<!--[if Webkit]>
I am Safari
<![endif]-->
</body>
</html>

If I open the page with Internet Explorer, all is ok, but with the other
browsers the page open is all blank.

Where is my errore?
Someone can help me?


You are confusing the two subjects that the web site is talking about -
"Conditional Comments" and "Conditional CSS".

"Conditional Comments" (HTML markup) are ignored by all browsers and can
be seen only in the source. The difference is that *only* IE does
something with <!-- [if ... to present something to the different IE
versions.

"Conditional CSS" is software to assist in providing visitors to your
web site with a stylesheet dependant on the browser that the visitor is
using (IE or any other). The Conditional Comments idea is used and
expanded to include all other browsers and not only IE, for Stylesheet
Rules. One stylesheet on the server containing Conditional Rules for
various browsers and the server sends only the ones needed for the
visiting browser.

You are trying to use the Conditional CSS Rules (called Statements on
their website) intended for Stylesheets as HTML Comments. <!--[if IE]>
is the same in both (for HTML Markup and Conditional CSS), therefore it
works in IE for you. All others are meaningless for IE and are ignored.
All, including the <!--[if IE]> are ignored by all other browsers.
 
D

dorayme

"Cricca" <[email protected]> said:
For try some experiment I have create a sample page with this code

<html>
<head>
<title>Crissing Browser</title>
</head>
<body>
<!--[if IE]>
I am Internet Explorer
<![endif]-->
<!--[if 'Gecko']>
I am Mozilla Firefox
<![endif]-->
<!--[if Opera]>
I am Opera
<![endif]-->
<!--[if chrome... ....

If I open the page with Internet Explorer, all is ok, but with the other
browsers the page open is all blank.

Where is my errore?
Someone can help me?

One of the nicest mistakes I have seen for a while! Yes, it might seem
that you can talk to various browsers this way. Unfortunately, (or
maybe not really), the conditional construction in the comments are
just for Internet Explorer. There have been various ways and hacks
that people have engineered or discovered to say things to various
non-IE browsers but there are much more important and robust other
things to remember than this.

Some differences are due to different browsers having different
default styles, you can be rid of these by attending to your CSS
sheet. Other differences can occur because your pages render in some
quirk mode (as can happen when there is no doctype declaration).

Most of the serious differences that are worth worrying about are
usually between, on the one hand all the modernish browsers except IE
on the one hand, and IE on the other. In other words, the conditional
that does work happens to be the one that even good webpage makers
find useful, the others that you are imagining would not be all that
useful.
 
G

Gus Richter

.... others that you are imagining ....


He's not imagining them. Just using them in the wrong place.

He read about them, as he said, on this Italian web site:
<http://www.dozarte.com/wordpress/20...-diversi-firefox-internet-explorer-7-e-ie-60/>
which in turn wrote about this web site:
<http://www.conditional-css.com/>

Perhaps my response to the OPs question now makes more sense? I was not
expressing an opinion on the software required to make this Conditional
CSS work, which he may or may not be using, at least not properly,
obviously.
 
D

dorayme

Gus Richter said:
He's not imagining them. Just using them in the wrong place.

Fair enough, I don't recall seeing your good post when I wrote that.
Is it browser sniffing at work along with other things?
He read about them, as he said, ...
which in turn wrote about this web site:
<http://www.conditional-css.com/>

Perhaps my response to the OPs question now makes more sense? I was not
expressing an opinion on the software required to make this Conditional
CSS work, which he may or may not be using, at least not properly,
obviously.

Fair enough again.

------------

btw, I am reminded:

Years ago, I either just tested or actually used this way for WinIE's
eyes only, *but not MacIE* (there was a MacIE back then):

/* Hide from IE5-mac. Only IE-win sees this. \*/

* html leftPicAndCaption {
margin-right: 10px;

* html ul {
height: 1%;
margin-left: 0;
}

/* End hide from IE5/mac */
 
D

dorayme

Gus Richter said:
I imagine so. I have never used the product.

Anyway...

Talking IE conditionals, I am having trouble today catering to IE6 on
my Mac running WinXP in VirtualBox. I might just have to launch a new
site and let it be a bit bad in IE6. Or find a machine that just runs
Windows and IE6 only to test?

But first, can anyone confirm that in IE6 the big text in the
following url is white on black? I have tried it with <!--[if IE6]>
and <!--[if IE 6]>, not sure that makes a difference?

<http://dorayme.netweaver.com.au/ie6ConditionalTest.html>

Perhaps there is a mistake I am not seeing?
 
D

dorayme

Gus Richter said:
But first, can anyone confirm that in IE6 the big text in the
following url is white on black? I have tried it with<!--[if IE6]>
and<!--[if IE 6]>, not sure that makes a difference?

<http://dorayme.netweaver.com.au/ie6ConditionalTest.html>


My IE6 renders white on black if I use <!--[if IE 6]> only.

Not sure what you mean by your "only"?

In the head, I now have:

<style type="text/css" media="screen">
p {color: black; background: white; font-size: 1.3em; width: 25em;}
</style>

<!--[if IE 6]>
<style type="text/css" media="screen">
p {color: white; background: black; }
</style>
<![endif]-->

If the conditional works, IE6 should be white text on black bg. It is
not appearing so in my IE6 on VirtualBox nor on screenshots from
Browsershots?

If, instead of above, I had:

<style type="text/css" media="screen">
p {color: black; background: white; font-size: 1.3em; width: 25em;}
</style>

<style type="text/css" media="screen">
p {color: white; background: black; }
</style>

most if not all browsers, including IE6, would show white on black.

But I may be getting the construction wrong, perhaps I will think more
clearly tomorrow.
 
D

dorayme

dorayme said:
Gus Richter said:
But first, can anyone confirm that in IE6 the big text in the
following url is white on black? I have tried it with<!--[if IE6]>
and<!--[if IE 6]>, not sure that makes a difference?

<http://dorayme.netweaver.com.au/ie6ConditionalTest.html>


My IE6 renders white on black if I use <!--[if IE 6]> only.

OK, I am now getting browsershot to show what I expect. But it is
impossible to rely on this as it takes about half an hour even when
requesting only IE 6. Maybe I will have to haul out an old PC box and
put XP and just IE 6 on it, really don't want to!
 
G

Gus Richter

Gus Richter said:
But first, can anyone confirm that in IE6 the big text in the
following url is white on black? I have tried it with<!--[if IE6]>
and<!--[if IE 6]>, not sure that makes a difference?

<http://dorayme.netweaver.com.au/ie6ConditionalTest.html>


My IE6 renders white on black if I use<!--[if IE 6]> only.

Not sure what you mean by your "only"?

I only get white on black with said:
In the head, I now have:

<style type="text/css" media="screen">
p {color: black; background: white; font-size: 1.3em; width: 25em;}
</style>

<!--[if IE 6]>
<style type="text/css" media="screen">
p {color: white; background: black; }
</style>
<![endif]-->

Same code as in your test case - same result - IE6 renders P element
white on black.
If the conditional works, IE6 should be white text on black bg.

Exactly so.
It is
not appearing so in my IE6 on VirtualBox nor on screenshots from
Browsershots?

I guess they don't work as expected? Don't support conditional comments?
If, instead of above, I had:

<style type="text/css" media="screen">
p {color: black; background: white; font-size: 1.3em; width: 25em;}
</style>

<style type="text/css" media="screen">
p {color: white; background: black; }
</style>

Using the both immediately above, although not proper, results in the
last overwriting. All P elements will be white on black for all browsers.
most if not all browsers, including IE6, would show white on black.

Exactly so.
 
G

Gus Richter

OK, I am now getting browsershot to show what I expect. But it is
impossible to rely on this as it takes about half an hour even when
requesting only IE 6. Maybe I will have to haul out an old PC box and
put XP and just IE 6 on it, really don't want to!

Ya gotta do whatcha gotta do. LOL
 
B

Ben Bacarisse

dorayme said:
dorayme said:
Gus Richter said:
On 1/15/2012 10:41 PM, dorayme wrote:
But first, can anyone confirm that in IE6 the big text in the
following url is white on black? I have tried it with<!--[if IE6]>
and<!--[if IE 6]>, not sure that makes a difference?

<http://dorayme.netweaver.com.au/ie6ConditionalTest.html>


My IE6 renders white on black if I use <!--[if IE 6]> only.

OK, I am now getting browsershot to show what I expect. But it is
impossible to rely on this as it takes about half an hour even when
requesting only IE 6. Maybe I will have to haul out an old PC box and
put XP and just IE 6 on it, really don't want to!

For what it's worth, my Linux-hosted VirtualBox XP machine shows what
you'd expect (white text on black) using IE6.
 
N

Neil Gould

dorayme said:
Gus Richter said:
I imagine so. I have never used the product.

Anyway...

Talking IE conditionals, I am having trouble today catering to IE6 on
my Mac running WinXP in VirtualBox. I might just have to launch a new
site and let it be a bit bad in IE6. Or find a machine that just runs
Windows and IE6 only to test?

But first, can anyone confirm that in IE6 the big text in the
following url is white on black? I have tried it with <!--[if IE6]>
and <!--[if IE 6]>, not sure that makes a difference?

<http://dorayme.netweaver.com.au/ie6ConditionalTest.html>

Perhaps there is a mistake I am not seeing?
Using "<!--[if IE 6]>" works as you expect with IE6, and is the syntax that
I've used for years to differentiate between IE versions.
 
D

dorayme

Ben Bacarisse said:
....

For what it's worth, my Linux-hosted VirtualBox XP machine shows what
you'd expect (white text on black) using IE6.

At the moment, it might be worth a beer just for friendly effort, but
if you want a chance at winning a round-the-world trip, 5-star
accommodation, first-class air travel for you *and* your family, you
need to tell me more.

I have no doubt that IE6 can and should see what you are seeing and
even on VirtualBox. The question is quite how. My XP installation came
with either IE8 if I remember and I installed it and later got hold of
something called MultipleIEs

My IE6 is showing, under Properties

"C:\Program Files\MultipleIEs\IE6\iexplore.exe"

Which has been useful but I better look into other ways of emulating
or running IE6 to get over this IE conditional problem I am having?

IE8 in compatibility view to get an idea of IE7 is good enough for
most of my purposes.

There is a page at

<http://www.quirksmode.org/css/condcom.html>

which has a note that says:

Note however, that if you use multiple Explorers on one computer, the
conditional comments will render as if all these Explorer versions are
the highest Explorer version available on your machine (usually
Explorer 6.0).

The last reference to 6.0 might be a typo? Or it might not be a
reference to IE but some other Win program, Windows Explorer?
 
D

dorayme

Neil Gould said:
Using "<!--[if IE 6]>" works as you expect with IE6, and is the syntax that
I've used for years to differentiate between IE versions.

Yes, thanks, me too. It is just a problem lately in my VirtualBox
installation it seems.
 
N

Neil Gould

dorayme said:
Neil Gould said:
Using "<!--[if IE 6]>" works as you expect with IE6, and is the
syntax that I've used for years to differentiate between IE versions.

Yes, thanks, me too. It is just a problem lately in my VirtualBox
installation it seems.
I checked it out on an older PC, running gen-you-wine IE6, so I know that
result is valid. If VirtualBox differs, it's pretty much wrong.
 
B

Ben Bacarisse

dorayme said:
At the moment, it might be worth a beer just for friendly effort, but
if you want a chance at winning a round-the-world trip, 5-star
accommodation, first-class air travel for you *and* your family, you
need to tell me more.

I don't think I can...
I have no doubt that IE6 can and should see what you are seeing and
even on VirtualBox. The question is quite how. My XP installation came
with either IE8 if I remember and I installed it and later got hold of
something called MultipleIEs

My IE6 is showing, under Properties

"C:\Program Files\MultipleIEs\IE6\iexplore.exe"

Which has been useful but I better look into other ways of emulating
or running IE6 to get over this IE conditional problem I am having?

My IE6 is in a virtual machine provided by Microsoft for compatibility
testing. I think these machines are still available, but it was a pain
to get it to work in VirtualBox.
IE8 in compatibility view to get an idea of IE7 is good enough for
most of my purposes.

There is a page at

<http://www.quirksmode.org/css/condcom.html>

which has a note that says:

Note however, that if you use multiple Explorers on one computer, the
conditional comments will render as if all these Explorer versions are
the highest Explorer version available on your machine (usually
Explorer 6.0).

The last reference to 6.0 might be a typo? Or it might not be a
reference to IE but some other Win program, Windows Explorer?

I'd guess a typo. Elsewhere on the page the same text excludes that
final reference, and the translations of the page (those that I can
read, at least) have all changed that text. That certainly looks like
the explanation.
 
D

dorayme

Ben Bacarisse said:
My IE6 is in a virtual machine provided by Microsoft for compatibility
testing. I think these machines are still available, but it was a pain
to get it to work in VirtualBox.

Yes, I read about this but noticed it could be a pain to install on
VirtualBox on a Mac. Will think about it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top