Testing CORS compatibility for IE8 using developer tools - javascript

I've set up a central WebApi site that will provide general CRUD capability for various sites across our domain. I've configured the whole shebang to utilize CORS with the standard jquery ajax httprequest or, in the case of older IE versions, XDomainRequest. So far, everything checks out, it works splendidly. My problem is that I can't seem to find a machine with IE8 in order to complete user agent testing. The site works wonderfully when I go into the developer tools on IE 11 and set it to emulate IE8 but I'm not ready to pop the champagne cork just yet.
My question is: will the developer tools' IE8 mode fully emulate that browser's behavior, down to the way it handles cross domain requests or do I need to either find a user with IE8 and have them test it or spin up a VM with it?

You can download a virtual machine with IE8 from Microsoft's modern.ie site at http://dev.modern.ie/tools/vms/ and test your site with that.

Related

Simulate a IOS environment for test website in safari

I'm developing an simples website using html, css/bootstrap and JS. I received feedback by Iphone user that some features not working in IOS mobile. Some Images not loading and counter-up not working too. In windows and android is working fine (chrome and Firefox). The question is, how I create a environment for simulate a IOS mobile for check how safari browser load my site? I tried install safari in windows but it not show equals execution in IOS. I think that browsershots not is a good ideia, because it works only with static content, and in the moment return 500 internal server error.
Microsoft BrowserStack provides a full test environment, however beyond the complimentary trial period it is not free. For errors related to pageload or reference, I would suggest you use device emulation and network throttling in a browser: Safari, Firefox, Chrome.
Some browsers are more forgiving of errors, so you may even have a typo. Is your trustworthy friend using an outdated browser while you require modern feature support? The scope of the problem seems undeserving of a bill for membership or tech support.

IE11 javascript fails unless debugger is launched

I hava situation where some javascript a web page works fine in Safari and Chrome, but fails in IE11. Unfortunately due to issues with confidentiality I cannot put the javascript up here.
In IE11 the web page's java script fails to operate correctly. By that I mean some of the javascript works and some doesn't. With no errors displayed or any other indication of whats wrong.
If I try to debug the page using IE's developers tools, all the javascript works perfectly without any errors or issues.
Searching on the net I found many people with the same IE problem - fails normally, works when debugging. The main issues they talk about is the console.log(...) statement. I checked my javascript and don't have any console.log(...) statements.
I then saw a stackoverflow thread where adding a cache:false to the $.ajax({... calls solved the issue. I added the same flag but the problem still persists.
Are there any other bugs I've not found?
The web page is using jQuery to handle most of it's manipulation of the DOM with a single $.ajax... call and a series of $.get(... calls polling the server.
How to debug your web pages.....IE11 tips.
All modern web browsers suppress scripting error messages and warnings by default. (In the early days web browsers would halt page loading/rendering and display a script error message with an alert statement)... this gives the best user experience who isn't concerned with the internal workings of web site code.
So, scripting errors will only BREAK execution if:
1. The browser debug tool is opened. and
2. The developer tools' Debug tab setting for Break on Exceptions has been turned on.
So to debug your web pages.
1. navigate to about:blank to start a testing cycle.....press f11 to display the dev tool, select "Break on all exceptions" from the dropdown (looks like a stop sign). Pin the dev tool to the bottom of the browser.
2. Return to the browser address bar and navigate to your test site (typed address of paste and go)...
The dev tool will now break on ALL exceptions and you will list them in the console tab.
IE has built-in content blocking and has ActiveX filtering (ad blocking) which can affect outcomes. You need to configure Internet Options so that the IE dev tool console will record any blocked content or security (XSS) errors.
Tools>Internet Options>Advanced tab, check "Always record developer console messages".
Also on the Emulation tab of the IE dev tool you will find the Emulation Mode (aka documentMode) that IE is using, and how it was established eg. x-ua meta, Enterprise site mode list, user Compatibility View list, etc
If you are developing an internal company website, the emulation mode used by IE may be for an earlier version of IE.. (IE8 on XP).. you should include this information with your questions.
You should also include the IE security zone that your site has been mapped to.. File>Properties menu in IE.... eg. Intranet zone as this can have different security and blocked content outcomes.
finally, the first step in troubleshooting web browser issues is to test in noAddons mode (for IE, winkey+r>iexplore.exe -extoff ). IE has built-in form-fillers and popup blockers... third-party addons can affect the outcomes expected.

Resolving IE compatability issues seemingly caused by Microsoft's own software

We're using a third party content management system built on ASP.NET. The pages seem to display in IE9 mode on IE11. I used the MS IE10 compat inspector tool http://blogs.msdn.com/b/ie/archive/2012/01/20/ie10-compat-inspector.aspx to try and work out why the page is not displaying in IE10 or Edge mode. (The HTML5 feature that I'm trying to use should display in IE10 or 11.) The only warnings the tool gives are about Javascript which is using window.navigator to do browser sniffing.
The code that is using window.navigator is in a file called webresource.axd:
var __nonMSDOMBrowser = (window.navigator.appName.toLowerCase().indexOf('explorer') == -1);
which itself seems to be part of ASP.NET.
There are no javascript warnings or errors. Here's one of the pages:
https://secure.wycliffe.org.uk/NetCommunity/SSLPage.aspx?pid=283. This is with IIS6 on Windows Server 2003.
Could this be the cause of the IE9 mode problem? (I have <!DOCTYPE html> at the top of the document.)
Is MS's own tool really complaining about bad practise in it's own software?
Ah ha! It's because your server is sending the pages down with an X-UA-Compatible header, telling Internet Explorer to use IE9 mode.
To see it, open https://secure.wycliffe.org.uk/NetCommunity/SSLPage.aspx?pid=283 in IE10, and press F12 to bring up the developer tools. Switch to the Network tab, press Start and refresh the page. Once it's loaded, double-click on the first item, then switch to the Response Headers tab.
You should see a header in there: X-UA-Compatible: IE=9.
To force IE to use the latest rendering mode, go into the IIS configuration, find where it's being applied, and either remove it, or change it to a newer version, e.g. IE=10. Alternatively, IE=edge will always use the latest version's standards mode rendering engine. Be aware it's probably there for a reason, though! We've had to use that header in the past as a short-term workaround for IE10 issues in legacy .net applications.
See MSDN: Defining document compatibility for more information.

Meteor.js Application does not support IE 9

We are developing an application using node.js and meteor.js, this application is working fine in Firefox, Chrome and IE 10, but when we try to browse this application in IE-9, it doesn't load.
I have investigated the request/response of both browsers (IE9, Firefox) and I have found that for XHR requests, IE 9 uses iframe polling instead of web sockets for data transfer. IE 9 does not maintain the cookies in this case and that causes 401 errors for every XHR request. So the cookie is not being sent in the iframe in IE 9.
I have investigated how we can enable cookies for the iframe, and I have found that we can achieve this using privacy policy platform (p3p). To enable the p3p you will have to add p3p key in response header and privacy.policy file in w3c folder inside the domain folder. I have done all of this.
But things are not working in my case, I have done a lot of R&D to set the different -2 key of p3p. But still facing the issue of loading the application in IE9.
You may not be able to get there from here.
But there's support in Flow Router apparently. Support appears to be package by package.
https://kadira.io/blog/meteor/flow-router-ie9

Replace remote JavaScript file with a local debugging copy using Greasemonkey or userscript

While debugging a client app that uses a Google backend, I have added some debugging versions of the functions and inserted them using the Chrome Developer Tools script editor.
However there are a number of limitations with this approach, first is that the editor doesn't seem to always work with de-minified files, and when the JS file is 35K lines long, this is a problem.
Another issue is that all the initialization that is done during load time, uses the original "unpatched" functions, hence this is not ideal.
I would like to replace the remote javascript.js file with my own local copy, presumably using some regex on the file name, or whatever strategy was suitable, I am happy to use either Firefox or Chrome, if one was easier than the other.
So basically, as #BrockAdams identified, there are a couple of solutions to these types of problem depending on the requirements, and they follow either 1 of 2 methods.
the browser API switcharoo.
The proxy based interception befiddlement.
the browser API switcharoo.
Both firefox and chrome support browser extensions that can take advantage of platform specific APIs to register event handlers for "onbeforeload" or "onBeforeRequest" in the case of firefox and chrome respectively. The chrome APIs are currently experimental, hence these tools are likely to be better developed under firefox.
2 tools that definitely do something like what is required are AdBlock plus and Jsdeminifier both of which have the source code available.
The key point for these 2 firefox apps is that they intercept the web request before the browser gets its hands on it and operate on the other side of the http/https encrpytion stage, hence can see the decrypted response, however as identified in the other post that they don't do the whole thing, although the jsdeminifier was very useful, I didn't find a firefox plugin to do exactly what I wanted, but I can see from those previous plugins, that it is possible with both firefox and chrome. Though they don't actually do the trick as required.
The proxy based interception befiddlement This is definitely the better option in a plain HTTP environment, there are whole bunch of proxies such as pivoxy, fiddler2, Charles Web HTTP proxy, and presumably some that I didn't look at specifically such as snort that support filtering of some sort.
The simplest solution for myself was foxyproxy and privoxy on firefox, and configure a user.action and user.filter to detect the url of the page, and then to apply a filter which swapped out the original src tag, for my own one.
The https case. proxy vs plugin
When the request is https the proxy can't see the request url or the response body, so it can't do the cool swapping stuff. However there is one option available for those who like to mess with their browser. And that is the man-in-the-middle SSL proxy. The Charles Web HTTP proxy appears to be the main solution to this problem. Basically the way it works is that when your browser makes a request to the remote HTTPS server, the ssl proxy intercepts the request and from the ip address of the server generates a server certificate on the fly, which it signs with its own root CA, and sends back to the browser. The browser obviously complains about the self-signed cert, but here you can choose to install the ssl proxy root CA cert into the browser, befuddling the browser and allowing the ssl proxy to man in the middle and make replacements and filters on the raw response body.
Alternative roll your own chrome extension
I decided to go with rolling my own chrome extension, which I am planning to make available. Currently its in a very hardcoded to my own requirements state, but it works pretty good, even for https requests and another benefit is that a browser plugin solution can be more tightly integrated with the browser developer tools.

Categories