For a sandwich, there is a piece of bread at the bottom.
I've tested window.blur() in
https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_blur
Please test the code in the above link.
But it seems it does not work.
The new window does not go to the bottom.
It appears on the top since it was created.
I can always see the popup since clicking the button.
I have tested it in two PC(windows 7 and 10) with newest chrome, firefox, IE. But none of them worked.
Maybe I am not understanding what window.blur() mean?
P.S window.focus() works well in any case.
Browsers generally ignore window.blur(). This is recommended by the spec.
User agents [browsers] are encouraged to ignore calls to this blur() method entirely.
Related
My web application uses alert and confirm boxes to display information when a link is clicked.
All browsers display these boxes properly except for Chrome. When I click on a link in Chrome, all I get is the box displayed with one word "Javascript" inside.
It has to work correctly in all browsers, even if the box displayed is constructed a little different in each. It barely works in IE but it does work and if you are going to use that crippled excuse for a browser, you deserve it! ;)
I didn't think this simple problem required a demo in jsfiddle and every one knows what an alert or confirm box looks like, nevertheless if someone needs more clarification please don't just not answer at all, but let me know.
Thanks,
Paul
well alert box is a browser component, therefore all browser vendor uses their own implementation. Since you want same result on all browser, the best you can do is use your own code to produce the result like using modalpopup which will be static around all browser
If you want to ensure cross platform and cross browser compatibility i would use something like:
jQuery Dialogs
Would be alot handier and ensure it looks/works the same everywhere.
Please note jQuery is just an example and any other alert/confirm like JavaScript/CSS would do the job just don't rely on the browser!
Please also note that browsers can change there implementation at any time leaving you stuck if you dont use your own!
I'm pretty new to web-coding and in my attempt to create jQuery based menu bars complete with dropdowns I have stumbled upon some vast differences between broswers. Below you can see that while FF and Safari are the same, IE is actually behaving and Opera is ok-ish, Chrome gets it totally wrong. As far as I can tell I have all the latest versions.
I removed the code from here and pasted it in: (doesn't want to let me link properly) so: jsfiddle.net/2hCR2/
Just in case, support for older versions of IE (6-7) is not required.
Right now I'm mostly concerned with the positioning aspect. Any assistance is much appreciated!
****EDIT:** After continuing to play with the chrome developer tools I realized that when I manually set the 1st list (pants/t-shirt) to display:block it displays as expected (exactly like FF and Safari in the image) so it appears that this is more of a javascript/jQuery issue not updating the DOM correctly(?). I also noticed that when I put the code is JSFiddle and ran the script in Chrome it produced the same error, but when I ran JSFiddle in FF (exact same fiddle link) it renders correctly.
It does not happen in Chrome Canary (version 24) but it does in stable (version 22). Apparently it is a bug which has been fixed.
You can either wait a month or two so that all Chrome users get the fix, or just use .show() instead of .show(0).
I have a page with lots of scrollable containers in it. All these containers contain some list or so. Everything works perfect in all the browsers except IE7 (Having tested in IE6 and below). In IE7 when I try to scroll by clicking on the scrollbar, its not happening. But if I double click on the scrollbar, then I will get the focus on the scrollbar and I will be able to scroll. The mousewheel scroll works perfectly though.
There are a lot of jquery plugins in my page such as datatable, jquery UI, autosuggest etc.
When I disable script in my browser, the scroll works fine.
Any idea on what is happening? (as an ie7 issue)
An uncaught javascript error may be the cause of your problem. Try using try...catch, e.g.
try {
//any questionable JS code
} catch(err){
alert(err.message);
}
If there is any error, that should let you know.
Without seeing your code I'm only able to guess that your page is throwing a javascript error in ie7. There are a few javascript functions that don't work in ie7 (such as getElementsByClassName which has caught me out before). I'd suggest debugging the javascript in ie developer tools or another debugging tool to find the problem.
It seems like theres an extra click event or something blocking the scrollbar, try using $(...).unbind('click') on those elements.
Some version of IE are temperamental to non-strict syntax, e.g. if you have a missing ; somewhere. An option is to run your code through jslint but this may prove tricky if your code is not well organised.
If you have IE9 you should be able to check for errors by hitting F12, roll back the version to IE7 and monitor the console output.
Trial and error is probably the answer, if all your code is just 1 big block then I'd suggest re-factoring into manageable chunks (classes methods) first.
Good luck.
If we can use a plugin :
http://jscrollpane.kelvinluck.com/
we can easily fix this issue of cross browser scroll pane.
An Example of this can be seen here:
http://nces.ed.gov/datalab/quickstats/default.aspx
Try clicking on one of the groups on the left and it should refresh the workspace with that group.
It works fine on all browsers in Windows 7 but fails in IE 7 and IE 8 on Vista.
I have this function:
function SelectGroup(gid, glevel, gtext) {
alert('not running on my environment only in vista');
}
And this is what calls it:
<a href="javascript:SelectGroup('3','3','Beginning college students')" style='text-decoration:none;'><span id='span_draggable_3' onmouseover="NavOver('3','3')" onmouseout="NavOut('3','3')" style='cursor:pointer;'>Beginning college students</span></a></div>
Some general suggestions:
Try to look if you have error messages, what do you mean by failed?
Try first with FireFox, it has better development tools.
IE8 has decent enough debugging tools, why wouldn't you use this?
Use a library like Mootools and JQuery to abstract differences between the major browsers
What about the old alert way of debugging things, have you tried it?
Try to narrow the problem the best you can, from my experience, this snipet is too big
edit: By telling in comments alerts don't run, it means you have an actual JS error somewhere and not a logic bug. Click on the error signal, bottom left of browser (yellow triangle with ! I believe), what is the message?
Edit: My friend, you have two other events I missed, What is the code of the onmouseover event, this might trash your code.
AND you have a </span> in the wrong place (no matching opening tag) this can also cause issues.
I'm simply opening a popup from JavaScript with the settings you can see in the code. Works fine in Firefox. In Opera it's opening it in a new tab instead. Why?
Here's a JSFiddle:
http://jsfiddle.net/hafWs/3/
The number of parameters doesn't seem to make a difference. Either work in Firefox and IE8. (Don't have IE9 or Chrome to test right now.)
I tried googling... can't find anything. I don't even see anything here that mentions it, yet it's clearly working in their examples: http://www.quirksmode.org/js/popup.html
Thank you for any help.
There is problem with spaces in options param:
window.showPopup = function(){
window.open(
'http://placekitten.com/600/500',
'thePopup',
'width=600,height=500' /* <------- Look, no spaces and works */
);
}
It is still a tab, but with different dimensions. So, it looks kinda as popup.
This is controlled by the browser itself (preferences) and cannot be changed from JavaScript.
NOTE: I've seen some posts that say you can determine whether the window opens in a tab or as a new window based on the parameters that you pass the window.open function. I have never seen this work consistently.