Force only part of a page into IE7 compatibility mode - javascript

I know you can force a whole page in IE8 or IE9 to render in IE7 mode by adding the meta tag
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">
But how can I make it so only part of the page gets rendered in this compatibility mode? I don't want to use iframes.

Unfortunately, you can't. But if you have access to the page, why can't you make it entirely compatible with all versions of IE?

Related

How to set IE 11 enterprise mode to standard mode using javascript or PHP?

I tried a lot for Ckeditor not working when I changed IE 11 standard to Enterprise mode.
I have set below in header for document mode but it does not seems:
<meta http-equiv="X-UA-Compatible" content="IE=8">
So I have substituted idea to turn off the enterprise mode while the page being load but i did not get any javascript code to turn off mode while page load.
Please suggest if any idea to turn off Enterprise mode using java script it would be great helpful.
I used TinyMCE editor instead of Ckeditor it has been worked fine.
Then i could used the meta header below tag:
<meta http-equiv="X-UA-Compatible" content="IE=8,IE=9,IE=7">
Still the TinyMCE completable with All IE browser.

Meta tag in JavaScript and Html scripts assuring web browser compatibility

I would like to get some advice regarding including meta tag assuring compatibility with IE 8. The thing is that my html code contained meta tag:
http-equiv="X-UA-Compatible" content="IE=8"
However it did not work because before the line with meta tag some javascripts had been running by the application in response render method:
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
response.render(CssHeaderItem.forReference(new CssResourceReference(BasePage.class, "CSSPage.css")));
}
So that the line with meta tag conforming the web browser compatibility had been placed further, not at the first place, so in consequence ignored.
I was trying to put some javaScripts lines in the code which were supposed to put meta tag at the beginnig of the html script:
$(document).ready(function(){
var meta = '<meta http-equiv="X-UA-Compatible" content="IE=8" />';
document.head.insertAdjacentHTML('afterbegin', meta);
});
It did not work either.
I would be grateful for any advice how to improve the code to make it compatible with desired web browser version: IE 8.
Cheers and Thanks,
JaneElle
It did not work either.
I would be grateful for any advice how to improve the code to make it compatible with desired web browser version: IE 8.
Cheers and Thanks,
JaneElle
Having <meta http-equiv="X-UA-Compatible" content="IE=8" /> in your page doesnt make it compatabile with that browser, I think you are confused on the usage.
The idea behind compatibility mode is to allow web sites and applications that are not designed to modern standards to continue to work while upgrades can be made, allowing end users to upgrade to the latest browser version.
read up on x-ua compatability here.

IE Compatibility mode change using javascript

Hi my aspx page is having some third party controls and those are not appearing when I upgrade my IE version to 11. Till IE10 everything was worked fine.
And when I change my compatibility mode of my IE like this http://winaero.com/blog/how-to-enable-compatibility-view-in-internet-explorer-11-ie11/
my controls are working fine. But I cant ask my end user to do the same.
Is there any way to handle this? I tried by adding below tag in section of my page.
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9"/>
But it is not working. Can some one tell me how to handle this through code?
It's just IE=9, not IE=EmulateIE9:
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
More here: How to Use X-UA-COMPATIBLE.
Of course, I would also look at migrating to new or different controls that work properly with a modern engine. Quote from the article above:
It is not a best practice to let issues like the example linger as your application is at risk of falling even further behind as web standards progress.

page opens in IE7 document mode instead of IE9

I know many variations of this question have been asked here but so far no solutions I have tried work for me.
I would like my web app to open in IE9 document mode in IE. When I open the page now, it always opens in 'Internet Explorer7 Standards), while 'Internet Explorer9 standards' is listed as the page default.
I have tried several variations of tagss, including
<meta http-equiv="X-UA-Compatible" value="IE=Edge">
and
<meta http-equiv="X-UA-Compatible" content="IE=7,IE=9">
(both right after the head tag)
I have also tried conditional statements, such as this example from S.O.:
<!--[if IE 7 ]> <body class="ie7> <![endif]-->
<!--[if IE 8 ]> <body class="ie8> <![endif]-->
<!--[if gt IE 8]><!--><body><!--<![endif]-->
Currently I am using: <!DOCTYPE html>
Of course I can manually switch the mode in F12, but I would like to site to open directly in IE9 Document mode (the Compatibility mode always defaults to IE9 Compatibility mode).
Currently I am working on an intranet development server; I have read that this may be a factor? But I would really prefer any solutions to be client-side, that I can add to the JS/HTML.....
Developer Tools Manually Overriding the Document Mode
If Internet Explorer 9 Standards is listed as the Page Default, this means you may have manually changed it to Internet Explorer 7 Standards via the tools. Just switch it back to Internet Explorer 9 Standards in the F12 Developer Tools themselves.
The tools will remember your explicit request to show the page in another Document Mode, and as such not revert to the page default. Consider the following from MSDN:
When you first load a webpage, F12 tools determines the default Document Mode and selects the appropriate mode. The text Page default in parentheses indicates the default mode of the webpage. A check mark appears next to the current mode of the document. Changing the mode causes the webpage to refresh, and remains in this mode until another mode is chosen or the browser is closed.
— Navigating the F12 Developer Tools Interface (emphasis in original)
If you'd like confirm this answer, open up a new browser window and navigate to http://stackoverflow.com. You should note in the F12 Developer Tools that it loads with a Document Mode of "Standards" (IE9 Standards if you're in IE9).
Switch Stack Overflow's Document Mode to IE7 Standards and refresh the browser. After refreshing you'll find that the browser stays with Document Mode: Internet Explorer 7 Standards, and lists Internet Explorer 9 Standards as (Page Default).
Compatibility View Settings
According to the MSDN resource How Internet Explorer Chooses Between Document Modes, the only other potential cause for this would be Compatibility View Settings.
In Internet Explorer 9, click Tools, then Compatibility View Settings. You can find your settings for Intranet sites there. In Internet Explorer 10 (Desktop Mode), you may have to press Alt to reveal the Tools menu item.
Just put following code and your IE browser would open by default in defined compatible view.
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9">
You can change "IE=EmulateIE9" to "IE=EmulateIE8" if you want make IE8 as default compatibility view.
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8">
The issue in my case was that a group policy had been applied on my company-issued laptop which explicitly set the domain that I was using to render in Compatibility Mode. I found this by checking the IE console (F12):
And I verified this by running the following command on my machine, which generated a report of applied group policies on my machine:
gpresult /h C:\gpresult.html
The report had a section like this, which included the root domain of the website I was working on:
You can put the following code sample too.
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
This will load your application in the default browser mode. And specially make sure to include this meta tag as the first tag just after the head tag. Other wise it will not work.

Tryied window.open with Ajax, window.print not working (IE9)

I'm trying to open new window and send form data with javascript and jquery-1.8.3.
With Bernhard's help I succeeded to call a new window with page for print.
(Thank you so much Bernhard. window.open and sending form data not working)
But, window.print() function does not working in IE9! (FF, Chorme do well)
I refreshed the page, then IE9 calls window.print()
Here is source code.
Print this
<script type="text/javascript" src="/common/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
function printPage(){
$.post('/common/print.jsp', {view:$("#ctn").html()}).success(function(response){
var oWindow = window.open('', "printWindow", "width=700px,height=800px");
oWindow.document.write(response);
oWindow.print(); // I added this line. But IE9 not working.
});
}
</script>
Is there something I missed?
Try this one:
$.post('/common/print.jsp', {view:$("#ctn").html()}).success(function(response){
var oWindow = window.open('', "printWindow", "width=700px,height=800px");
oWindow.document.write(response);
oWindow.document.close();
oWindow.focus();
oWindow.print(); // I added this line. But IE9 not working.
});
checkout this:
Using HTTP Headers to Force Standards View in Internet Explorer 8 and Above
You can also use meta tags to force standards mode. The X-UA-Compatible meta tag tells Internet Explorer what view mode to use or emulate.
By setting this meta tag, you tell IE to use standards mode even if there are comments or an XML declaration above the DOCTYPE. You determine what version of Internet Explorer can best view the page, and then set the meta tags to define that version.
IE 7:
<meta http-equiv="X-UA-Compatible" value="IE=7">
IE 8:
<meta http-equiv="X-UA-Compatible" value="IE=8">
IE 9:
<meta http-equiv="X-UA-Compatible" value="IE=9">
If a customer comes to a page with a view mode higher than it supports
(e.g. an IE 7 browser viewing a page asking for IE8 view mode), it
will ignore the tag and render the page the the mode it would have
without the tag.
More info find here: http://webdesign.about.com/od/internetexplorer/qt/force-compatibility-view-in-ie.htm

Categories

Resources