IE Compatibility mode change using javascript - 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.

Related

Does HTML5 work in a .hta file?

I am trying to understand what the main difference between hta and html files is. I googled it and I found this:
The main problem is that javascript is buggy. For example the
javascript: protocol does not even exist. Hta seems to prefer VBscript
modeled coding instead of the javascript model, such as
<span style="cursor:hand" onclick=go()> instead of
<a href="#" onclick=go()>. It's a windows exe so some
cross-browser/cross-platform contructs of html are simply not
supported or ill-supported. Also window resizing produces different
dimensions.
I have some interactive plots (HTML5) generated by JavaScript codes. Are they gonna be functional if I transfer them to hta files?
If you don't add any special code, the answer is no.
Usually, HTML5 doesn't work in HTA files because they are run by mshta.exe which acts like IE7 and HTML5 isn't supported in earlier versions of IE than IE9. But if you add <meta http-equiv="x-ua-compatible" content="ie=edge" /> in the head of the HTA, the HTA will act like the version of IE installed on the computer, so if the computer has IE9 or later and you add that tag, it will work. The problem with this is that if you upgrade the HTA, the <hta:application/> tag won't have any effect so you will lose all effects like icons, window properties, etc. For this reason, I prefer to not upgrade the HTA and to use workarounds instead of HTML5.
In HTA, to get the code to properly work, you must include the tag <meta http-equiv="x-ua-compatible" content="ie=edge" /> or <meta http-equiv="x-ua-compatible" content="ie=9">to get the JavaScript and HTML 5 to work completely. You may add
<HTA:APPLICATION
APPLICATIONNAME="HTA"
ID="HTA"
VERSION="1.0"
MAXIMIZEBUTTON="no"/>
Or some variant of that to get the HTA window to work properly. If you would post the code, Hamid K, that you are referring to, I would check it for you to more thoroughly answer the question.

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.

Force only part of a page into IE7 compatibility mode

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?

What is the best way to determine if a web-page is for mobile?

Should I scan for tags in the html code? Or what? What determines whether a page is optimized for mobile?
One option is to scan for tags. If so, what other tags are there?
<link rel="apple-touch-icon" href="..." />
<meta name="viewport" content="width=device-width, user-scalable=no" />
Another option is to see if the HTML returned from a mobile user-agent is smaller than the HTML returned from a desktop browser. user agent...
Any thoughts?
One option: look for: <meta name="MobileOptimized" />
Another: <meta name="HandheldFriendly" content="true"/>
Another: doctype is either XHTML-MP or WML (or other mobile-friendlies).
Here's a usefuil link for sniffing out different smartphones using JavaScript.
http://www.hand-interactive.com/resources/detect-mobile-javascript.htm
However, its worth paying attention to the caveats in the above link. Particularly, the fact that we are browser sniffing, which is inherently unreliable (I recently got a hit on my website for MSIE 999.1)
What exactly are you trying to accomplish?
Officially, there is no such thing as a mobile page. It's perfectly possible to create a page that works equally well on mobile as on desktop browsers. Hell, if you just make a page with simple html and no styling it will already do that.
These days we often see seperate mobile pages, but usually this is an indicator that the design of the 'normal' page was not thought-through.
Long story short, you could never detect this 100% because there's no real difference.
If you want to find out whether or not a browser is mobile or not, check this out: http://wapl.info/coding-for-the-mobile-web-with-WAPL/chapter/isMobileDevice-via-CURL/
Pass through all of your headers, and the web service will do the rest.
Better than detecting mobile with javascript, or looking for specific tags - do it before you even start outputting anything to the screen.

Categories

Resources