IE does not recognize my script - jquery-selectors

hello friends I have a big problem with internet explorer, I made a date validation using "select" with jquery, in Mozilla and crome works, but IE does nothing. Please I need help!

Your JS code calls for elements that aren't created in IE version less than 7 - thus it does nothing. See below:
<!--[if lt IE 7]>
<script type="text/javascript">
document.createElement("#date-star-month");
document.createElement("#date-star-year");
document.createElement("#date-finish-month");
document.createElement("#date-finish-year");
document.createElement("#date-star-month option");
document.createElement("#date-star-year option");
document.createElement("#date-finish-month option");
document.createElement("#date-finish-year option");
document.createElement("year_star");
document.createElement("year_finish");
</script>
<![endif]-->
This will not work in IE older than 7 - tested on 9, didn't work, until I ran IE9 in quasi-IE7 mode.
Additional pointers
Would be much easier to answer your question if you would be more specific.
Adding your code was a good move, do that from the start.
Too bad you didn't:
let us know what the validation function is supposed to do
on what browsers (with their versions) have you tested this
Also, if you state your intentions (why do you need that data validation, what it must do, etc.) you can get extra tips to achieve this in other (maybe better or easier) way.

Related

navigator.MaxTouchPoints returns 2 on Edge browser on windows laptop even though it is not a touch device

Edge browser returns 2 for navigator.MaxTouchPoints. We use the property to detect a touch device. Is there another way to accomplish this?
I also have this behaviour. It is caused when a laptop has a multi-touch capable touchpad. There was even a microsoft issue for this (however has been removed)
If I run the following test from my edge (Microsoft Edge 44.18362.449.0 and HTML 18.18362) all values are green (which is invalid).
There are some proposed fixes here.
Update:
Unfortunatly the first test from the patrickhlauke testpage with a real touchscreen and the old edge revealed the following:
"Touch feature detect" => all red Which is plain wrong.
However the navigator.maxTouchPoints are different:
navigator.maxTouchPoints (real touchdisplay) = 10
navigator.maxTouchPoints (Touchpad) = 2
So I will do something like this:
if(Browser=edge && maxTouchPoints > 2) => real Touchdisplay
if(Browser == edge && maxTouchPoints <=2) only tochpad not real touch display
=> After 2021-03-09 when the old edge is EOL'd I will remove that code...
not sure whether you are using MS Edge (EdgeHtml) browser or MS Edge chromium browser. You also did not mention the version of the browser.
I tested with both browsers and based on my testing I found that navigator.MaxTouchPoints returns 0.
Test code:
<!DOCTYPE html>
<html>
<head>
<script>
alert("navigator.maxTouchPoints = " + navigator.maxTouchPoints);
</script>
</head>
<body>
</body>
</html>
Output:
If you are using an older version then I suggest update it with the latest version and again make a test.
If the issue persists then try to provide the detailed information with snapshots may help to narrow down the issue.

GWTBootstrap3 components rendering incorrectly in IE11

My page elements should appear in all browsers as follows:
I can only achieve this in IE11 by having the dev tools open during page load, otherwise the page generates as the following:
Summary
no rounded corners on box elements
no column alignment (bootstrap class "col-lg-2" on
all label elements)
Legend formatting not added
general alignment off
no smooth accordion transition - open or closed
This issue is only with IE11, the site works in chrome, firefox and even Safari without any additional plumbing. I have found some IE fixes on SO, but so far none of them have worked:
*.html - add meta information to use Edge engine
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<html>
<head>
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<![endif]-->
... html continues with rest of head
*.js - to prevent undefined console from blocking processing
if(!window.console) {
console.log(item);
}
I have been sure to use Ctrl F5 when reloading the page for testing, and have also restarted devmode to see if that makes a difference. I have also confirmed that the site is not running in compatibility mode by looking in the compatability settings.
Looking through the logs I can see that when the page loads with dev tools closed, the binding is carried out using user.agent=ie8, whilst with devtools open, the binding property is user.agent=gecko1_8. I thought IE11 should always use the gecko1_8 permutation - why could this not be happening?
(using GWT Version 2.7)
Not sure if this will be of any help.
We are using GWT (2.8, but I think it also worked with 2.7 in the past).
With GWT-Bootstrap3 (https://github.com/gwtbootstrap3/gwtbootstrap3) without any problems in IE11. I am not sure you are using the same bootstrap library ?
Anyway. We added the following line in our html file (as the first line of the head tag) :
<meta http-equiv="x-ua-compatible" content="IE=10">
I can not really remember how I came up with this line, but the version history states : "It is now possible to use IE11 in compatibility mode"
So it has to do something with fixing something in IE-11, using GWT and bootstrap 3 :-)

GWT 2.7: Warn users they are using an unsupported browser

I recently upgraded my application to GWT 2.7 from GWT 2.5. This has caused me to drop support for IE6 and IE7.
I would like to provide users with IE6 or IE7 with a warning that their browser is outdated and will not work. At the moment if you go to the app with one of those browsers, you get a blank screen.
I know there are a couple ways that I could hack something together but I would rather use the GWT way, rather than some hack. Is there a GWT hook for unsupported browsers?
Option (hack) One
Drop this into my main.html:
if(document.documentMode === 6 || document.documentMode === 7){
myUnsupportedBrowserWarningFunction();
}
Potential problem with this is that if someone is using a browser that GWT doesn't recognise and I don't recognise (mobile opera? Some other browser), they will still get a blank page.
Option (hack) Two
GWT looks for the compiled JS here:
gwt/myApp/ASDFKLSDJFLSFDJSLDFJLSJDFSDES.cache.js
When someone is using an unsupported browser the following is requested (and is not found):
gwt/myApp/undefined.cache.js
It would be possible to create undefined.cache.js and put your unsupported browser code there. This is obviously a brittle solution and will break with future GWT updates.
Option Three
A recent patch (available in GWT 2.7) allows you to provide a default
permutation (e.g. safari) if GWT can not detect the browser and with
deferred binding you can display a warning that the provided app might not
work correctly as the browser is generally unsupported by GWT.
-- J.
Source
I don't want to set a default permutation for unsupported browsers. I want the site to not work and to display a warning. So this solution doesn't really provide what I am looking for.
Similar Questions & Posts
The same question was asked for an eariler version of GWT in 2009. I hope that GWT has added some kind of hook or best practice in the last 6 years.
More info on setting a default (fallback) permutation
You should be able to use onLoadErrorFn for that: https://code.google.com/p/google-web-toolkit/issues/detail?id=8135
<script>
function gwtLoadError(errMsg) {
// GWT app couldn't load, reason in errorMsg
}
</script>
<meta name="gwt:onLoadErrorFn" content="gwtLoadError">
or possibly onPropertyErrorFn:
<script>
function gwtPropError(propName, allowedValues, actualValue) {
if (propName == 'user.agent') {
// unsupported browser
}
}
</script>
<meta name="gwt:onPropertyErrorFn" content="gwtPropError">
(I don't think user.agent.runtimeWarning would help in this case, but maybe have a look)
There is an easy way:
Conditional Comments
<!--[if lt IE 8]>
<p>You are using an unsupportet browser. Please perform an update</p>
<![endif]-->
I think Option 3 may be the best one, but there is a problem: This will start the actual application (which still may be incompatible).
If this is an issue and you want a clear warning, you can rewrite the permutation selection script (You would need to update the script with the upcoming GWT releases)
You will need to copy this source:
https://gwt.googlesource.com/gwt/+/2.7.0/user/src/com/google/gwt/useragent/rebind/UserAgentPropertyGenerator.java
You could add something like:
$wnd.Location.replace('nosupported.html');
between line 90 and 91

FB is not defined on Firefox 4

FB is not defined in Firefox 4 but works on lower Firefox versions, Internet Explorer, Chrome, Safari. I've tried async loading and the following solutions mentioned here
FB is not defined error in Firefox 4
How to workaround 'FB is not defined'?
I've also removed extensions that could trigger this such as AdBlock.
Anybody here experienced the same thing? I don't know what I could've missed... oh boy...
Also, I am experiencing many errors in Firefox 4 when I visit other websites... makes me wonder if the FB is not defined error is a Firefox bug or something...
Man!
I'd really appreciate any opinions or suggestions... Thanks!
It may not be the exact same problem but one thing that worked for me was to move the FB include right to the top of the head element.
<head>
<script src="http://connect.facebook.net/en_US/all.js" language="Javascript" type="text/javascript"></script>
...

Dojo addOnLoad, but is Dojo loaded?

I've encountered what seems like a chicken & egg problem, and have what I think is a logical solution. However, it occurred to me that others must have encountered something similar, so I figured I'd float it out there for the masses.
The situation is that I want to use dojo's addOnLoad function to queue up a number of callbacks which should be executed after the DOM has completed rendering on the client side. So what I'm doing is as follows:
<html>
<head>
<script type="text/javascript" src="dojo.xd.js"></script>
...
</head>
<body>
...
<script type="text/javascript">
dojo.addOnLoad( ... );
dojo.addOnLoad( ... );
...
</script>
</body>
</html>
Now, the issue is that I seem to be calling dojo.addOnLoad before the entire Dojo library has been downloaded the browser. This makes sense in a way, because the inline SCRIPT contents should be executed before the entire DOM is loaded (and the normal body onload callback is triggered).
My question is this - is my approach sound, or would it make more sense to register a normal/standard body onload JavaScript callback to call a function, which does the same work that each of the dojo.addOnLoads is doing in the SCRIPT block. Of course, this begs the question, why would you ever then use dojo.addOnLoad if you're not guaranteed that the Dojo library will be loaded prior to using the library?
Hopefully this situation makes sense to someone other than me. Seems like someone else may have encountered this situation.
Thoughts?
Best Regards,
Adam Rice
You're doing it correctly. External Javascript files are loaded and executed synchronously in order, so by the time it reaches your dojo.addOnLoad( ... ); Dojo has loaded. Use dojo.addOnLoad instead of window.onload for two reasons:
it fires earlier, because it utilizes DOMContentLoaded
it handles asynchronous loading of dojo.require by postponing the execution until all required scripts have been read
Explained in DojoCampus as (dojo.addOnLoad):
dojo.addOnLoad is a fundamental aspect
of using Dojo. Passing addOnLoad a
function will register the function to
run when the Dom is ready. This
differs slightly from document.ready
and body.onload in that addOnLoad
waits until all dojo.require() (and
their recursive dependencies) have
loaded before firing.
This might have nothing to do with your problem, but ive just had a case where I had the same symptoms. For me everything worked fine for Firefox, Chrome etc, but not IE8.
I was getting what looked like dojo not being loaded, an error in IE8 saying that dojo was undefined (but not all the time) and i could strip everything down to just style sheets and importing dojo and still get the error.
I was running a local google app engine development server. This looks to be based on pythons SimpleHTTPServer which in turn uses SocketServer.BaseServer. This has BaseServer.request_queue_size which defaults to 5 - i couldn't find anything in app engine which overrode this value so i guess the development google app engine server has an upper limit of 5 connections.
Using regedit and going to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings
“MaxConnectionsPerServer”=dword:00000010
“MaxConnectionsPer1_0Server”=dword:0000010
This shows that IE was going to try and open up to 10 simultaneous connections. I edited these two keys and made them 2 and restarted the computer, the problem went away.