I'm using ASP.NET 4.5 on the server and I have a .NET Windows application with a Web Browser control that navigates to the web page on the server.
If I run the Windows application on a system with Internet Explorer 11, I get a script error: "Object doesn't support property or method 'attachEvent'" when navigating to another page. The script file is ScriptResource.axd so it isn't any of my scripts.
I do know that Internet Explorer 11 doesn't support attachEvent anymore (replaced with attachEventListener?). That is however not of much help here, as the javascript is part of the framework, not in my code.
I found the javascript source for the framework here:
http://ajaxcontroltoolkit.codeplex.com/SourceControl/latest#Client/MicrosoftAjax/Extensions/Sys/WebForms/PageRequestManager.js
// DevDiv Bugs 100201: IE does not set referrer header on redirect if you set window.location, inject anchor node instead
// dynamic anchor technique only works on IE
if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
var anchor = document.createElement("a");
anchor.style.display = 'none';
// cancel bubble so body.onclick is not raised
anchor.attachEvent("onclick", cancelBubble);
// more code...
}
This is the Sys.Webforms.PageRequestManager module that is part of the core ASP.NET framework as far as I understand.
The line that performs attachEvent gives script error on Internet Explorer 11, but works great on older versions of Internet Explorer.
How to fix this problem? Are there any known workarounds? I couldn't fine any updates for this.
Try forcing the browser to render in IE 10 mode...
<meta http-equiv="X-UA-Compatible" content="IE=10" />
I got that problem with jQuery 1.10 and it seems, that IE11 lacks the support of "attachEvent" which is used in jQuery and which seemed to be used by your framework as well. There is a Microsoft bugticket for that: Bugticket attachEvent IE11
I've found a solution in the related jQuery bugticket. Just insert the following code before your framework:
var isIE11 = !!(navigator.userAgent.match(/Trident/) && !navigator.userAgent.match(/MSIE/));
if (isIE11) {
if (typeof window.attachEvent == "undefined" || !window.attachEvent) {
window.attachEvent = window.addEventListener;
}
}
You first check if the browser is IE11 and then bind the attachEvent listener again so the error doesn't occur again.
Related
When We use Telerik UI for ASP.NET AJAX's telerik:RadAsyncUpload control to upload multiple photos (have preview before being uploaded), it works on all browsers in my local dev environment and our test server. It works on Chrome and IE in our beta and prod servers. But it doesn't work on Firefox in our beta and prod server; it kicks user out and redirect them to login page. We debugged into it and found the reason is that the session is lost. For some reason, Firefox will cause session lost.
Our beta and prod servers have load balancer while our test server doesn't. But even try individual ip address (not using domain name) in beta/prod, it still have the same problem.
Our code is based on the following link's sample code.
http://www.telerik.com/support/code-library/preview-image-before-it-have-been-uploaded-with-radasyncupload
I am not sure if this problem is related to Telerik control, or is it just a FireFox problem. It seems to me more like the latter.
This problem is really weird. It has been several weeks and we are still not able to solve it.
We have fixed the problem. The problem is still FireFox's bug, as indicated in that post
http://www.telerik.com/support/code-library/preview-image-before-it-have-been-uploaded-with-radasyncupload
The trick part is how to fix this bug: delay 10 ms before calling showThumbnail(...). Notice you cannot put the delay inside showThumbnail(...), that doesn't work.
window.CurrentFileUploaded = function (radAsyncUpload, args) {
...
if (navigator.userAgent.indexOf("Firefox") != -1) // if FireFox, delay 10 ms. This is the fix for FireFox bug!!!
{
setTimeout(function () { showThumbnail(...); }, 10);
}
else
{
showThumbnail(...);
}
}
After utterly disbelieving our client when they claimed they couldn't type full stops (periods) into the HTML Editor control of the Ajax Control Toolkit on their ASP.net site, I've now sadly been forced to accept it is the case.
When you press the . key, and the cursor is at the final position in the editor nothing is added to the HTML Editor control at all.
If there are any characters after the cursor position, the . works normally.
If you hit return to enter a newline, and press . it works once.
This only only occurs in IE 11, older versions of it are fine, as are Chrome, Firefox and Safari. We are using the September 2013 release of Ajax Control Toolkit.
Has anyone else encountered this? Any advice would be much appreciated.
After doing more googling specifically around AjaxControlToolkit and IE11, I found a number of people complaining about problems with the current version of ACT (the Sept 2013 release) and IE11.
e.g. Here, here and here
It seems the problem is with .net failing to identify IE 11 as an IE browser, causing various AjaxControlToolkit features to fail.
The workaround I'm using at present is to add the X-UA-Compatible http header to our site, to force IE11 to process the page with in IE10 mode.
<meta http-equiv="X-UA-Compatible" content="IE=10">
There is also this .net4 hotfix from Microsoft which should fix the problem completely when applied to your web server.
Hope this helps someone else.
I found a similar problem with v3.0.30930 in Chrome, I tracked it down to the DesignPanelEventHandler. Specifically when conditionally dealing with deletions in various browsers when clicking the backspace button. In certain situations the code looks for a keycode of 46 or Sys.UI.Key.backspace, however in Chrome the full-stop keycode on keypress is also 46, causing all sorts of problems and finally meaning the event is stopped and the full-stop is never entered into the panel.
I overrode the DesignPanelEventHandler functionality and added the following condition in before the deletion logic and stopping the event (around about line 503 in HTMLEditor\DesignPanelEventHandler.js). As far as my tests go this seems to work fine:
if (key != String.fromCharCode(Sys.UI.Key.backspace).toLowerCase())
break;
After installing .NET 4.5 to my web server I'm getting script errors trying to access my AbleCommerce store in Internet Explorer. I've tried setting the site to target .NET 4.0 again but it still doesn't work in IE so I'm not sure what's going on. I'm not sure if this is a Ajax Toolkit issue or something changed after installing .NET 4.5.
I CAN login using Chrome and FireFox but accessing the login page (click My Account or Login on the top right) shows a script error if you have IE's settings to show script errors.
Any help would be GREATLY appreciated.
SCRIPT5007: Object expected
login.aspx?ReturnUrl=%2fMembers%2fMyAccount.aspx, line 539 character 1
document.getElementById('ctl00_wpm_Login_ctl03_LoginValidationSummary').dispose
= function() {
Array.remove(Page_ValidationSummaries, document.getElementById('ctl00_wpm_Login_ctl03_LoginValidationSummary'));
}
(function(id) {
var e = document.getElementById(id);
if (e) {
e.dispose = function() {
Array.remove(Page_ValidationSummaries, document.getElementById(id));
}
e = null;
} })('ctl00_wpm_Login_ctl04_RegisterValidationSummary');
Page_ValidationSummaries gets populated with ALL validation summaries, even for controls that are not rendered to the browser
Which means it ends up with nulls in it.
Or in this example here, you are trying to remove "null" from the array, which is the converse issue.
I had to roll back to .NET 4.0 by uninstalling 4.5 from the server (and then reinstalling 4.0) to resolve this. Could not find a solution.
I have a complete ASP.NET that makes heavy usage of your DevExpress ASPx suite of controls. Grids, text boxes, round panels etc.
THe site works flawlessly in Chrome, Firefox however in IE some UI does not function. Example, i have an ASPxComboBox control. In IE it doesn't "Drop down".
Using F12 developer tools on the console line the following shows as the error code when the dropdown should fire
SCRIPT87: Invalid argument.
DXR.axd?r=1_42-DSzC3, line 1268 character
The function is below, line 1268 is line 5 in the code below
function _aspxCreateStyleSheetInDocument(doc) {
if(__aspxIE)
return doc.createStyleSheet();
else {
var styleSheet = doc.createElement("STYLE");
_aspxGetChildByTagName(doc, "HEAD", 0).appendChild(styleSheet);
return styleSheet.sheet;
}
}
Any suggestions where to start ?
Is resource merging enabled in web.config?
<devExpress>
...
<compression enableHtmlCompression="false" enableCallbackCompression="true"
enableResourceCompression="true" enableResourceMerging="true" />
...
</devExpress>
This issue is a specific of the IE browser (it can be encountered when too many stylesheet links are registered within a page). To resolve this issue, it is recommended that you enable “Resource Merging” http://help.devexpress.com/#AspNet/CustomDocument6911 option.
If AutoFormats/Themes are used, deploy controls skin via the «ASPxThemeDeployer” http://help.devexpress.com/#AspNet/CustomDocument7485 tool in the “Only skin files” mode.
See Also:
http://www.devexpress.com/kb=K18487
The following code is being used to disable a Submit button once it has been clicked. This works great on desktop browsers and most BlackBerry mobile browsers.
Submit.Attributes.Add("onclick", "javascript:this.disabled=true;" +
ClientScript.GetPostBackEventReference(Submit, null));
Unfortunately, when using a BlackBerry Storm clicking the submit button causes the device to just reload the page. If I remove this code the Storm browser submits the page just fine. I need to disable the button when the browser is capable of doing so but do not want to affect browsers that are not JavaScript capable.
I realize I could add the jQuery framework and only attach the event client side, but am trying to look for the simplest fix (read least intrusive) as this is a legacy application. Any suggestions?
I believe you can do it this way - I haven't done this in a long time and some of the HttpCapabilities API has been tagged as obsolete, but in general you can detect if the browser supports javascript by doing this:
var myBrowserCaps = Request.Browser;
if (((HttpCapabilitiesBase)myBrowserCaps).EcmaScriptVersion.Major > 1)
{
// Browser supports javascript
Submit.Attributes.Add("onclick", "javascript:this.disabled=true;" +
ClientScript.GetPostBackEventReference(Submit, null));
}