Do modern browsers block <a href="javascript:window.open....?
I want to pop up a window for people开发者_开发技巧 to share to Facebook.
The only way to do this is through javascript. (pop up a small window width=400, height=200)
Will Chrome/IE/Google pop up blockers block this?
How to get around it?
Modern browsers will not block what you're attempting to do.
All modern browsers do implement tech to block popups. What this means is all window.open calls must be within a click event handler, or within a function called by said handler. As long as you are creating a pop up in response to a user action you should be fine.
If you are attempting to call window.open as soon as the dom is loaded, or after a short delay (example: setTimeout(50, window.open())) then it will be blocked.
Don't use popups – use a javascript modal window, with the href pointed to real content if appropriate.
For most users, popups are very annoying.
精彩评论