.ie8-7-6 .loginForm {display:no...">

Can I use conditional comments from Chrome Frame?

Using...

<!--[if lte IE 8]> <html class="ie8-7-6"> <![endif]--> .ie8-7-6 .loginForm {display:none;} /* The login form is hidden. */ 

and

 .ie8-7-6 .yourbrowserisold {display:block;} /* and some nice graphics appear to indicate it doesn't support IE6, 7, or 8. */ 

So this works very well and I provide a link to download Chrome Frame.

But now, if Chrome Frame is installed, I would like it to be oposite.

 <!--[if CF]><html class="chrome-frame><![endif]--> .chrome-frame .yourbrowserisold {display:none;} .chrome-frame .loginForm {display:block;} 

But

 <!--[if CF]><html class="chrome-frame><![endif]--> 

doesn't work, and I need a login form.

I have searched for dozens of websites and I cannot find the answer if ...

a. is this even possible with conventions?

b. or is it only possible with javascript?

Any help?

----- Update ---------- Here is a script to determine if Google Frame is installed or not.

 $(document).ready(function() { if( $.browser.chromeframe != window.externalHost) {alert("You are using chrome frame. You rock!"); } else { alert("You are not using chrome frame."); } }); 

FYI: you can add your own jQuery to the above script for target Chrome Frame users.

----- Demo: https://dev.clientwhys.com/index-dummy-ie.iml

+1
source share
1 answer

The best way to detect that you are in Chrome Frame inside IE is checking

 var isChromeFrame = !!window.externalHost; 

This is only available in Chrome Frame. There is currently no conditional construct for comments on Chrome Frame.

More details at http://www.chromium.org/developers/how-tos/chrome-frame-getting-started/understanding-chrome-frame-user-agent .

But to your situation, if the user already has Chrome Frame installed and you start it using the chrome=1 flag, then they will never see the content inside the conditional comments of IE.

+2
source

Source: https://habr.com/ru/post/1446543/


All Articles