Renato Lazaro Renato Lazaro - 10 days ago 6
Javascript Question

Why does alert return this way in Chrome?

Folks! I'm wondering where to start to understand why JavaScript alert returns in Chrome in this way. Can it be lacking JavaScript in PHP source code? .Where should I start to understand and diagnose the problem?

My Script



"<script type='text/javascript'>
$(document).ready(function(){
$('#menu2').click(function(event){
event.preventDefault();

alert('Text');
})
});
</script>";





Result Chrome:

enter image description here

Result Mozilla

enter image description here

Answer

The reason the default pop ups in chrome don't look good is because they aren't really important, so there's no reason for the developers at Google to spend a bunch of time designing and building beautiful ones. If you look at the pop ups in most other browsers (to the best of my knowledge), they will look similar.

Your second screenshot looks like some sort of modified version (possibly bootstrap?) and has absolutely nothing to do with the default pop up.

So to answer your question, no, there is no missing javascript or PHP source code. It's just a design choice on the part of Google to focus resources into more important areas.

If you want to change the look, you can't. It's part of the browser, not part of the website. But, if you really need to have a better looking one (and I would strongly recommend you look into different options as pop ups are bad UX), http://jqueryui.com/dialog/ will be able to help.

Comments