April 12th, 2013, 02:32 AM
Chrome doesn't show my message in alert box
When I have JS popup an alert box in FF it shows the msg I created. When using Chrome all it says is "The page at localhost says OK" Is this a bug in Chrome or is their a different way of getting it to display my msg?
April 12th, 2013, 07:02 AM
I have a car. When I turn the key in the ignition the engine does not start. What is wrong with it?
April 12th, 2013, 07:40 AM
hmmm.. Just about any old code would do. I copied this one from w3schools. The problem is when I run this script in FF I get a proper alert box. When I run it in Chrome I dont. If I could upload a jpg showing yo Chrome's alert box I would. but your forum doesn't allow that. Maybe you could try it in Chrome yourself and see if you get the results I got.
alert("I am an alert box!");
The same thing is true of an Confirm box. Works in FF not in Chrome. haven't tried other browsers. Point to note. Popups are blocked in both browsers.
April 12th, 2013, 08:16 AM
I cannot reproduce the issue, and I'm not aware of any such bug.
But there's a simple solution: Don't use w3schools, don't use alert(). Both is crap.
w3schools is pretty much the worst site for learning I can think of. It's infamous for wrong and obsolete information, bad advice and plain nonsense. They are not affiliated with the W3C. They just use their name to -- I guess -- trick people into believing they're an "official" website and to sell their useless certificates. There are desparate attempts of driving people away from that site, but obviously w3schools still manages to pop up in every search result and fool people that are new to web programming.
The alert() function is terrible for usability. It blocks the whole browser window and everything happening of the page. This function is just useless, it's one of those leftovers from the 90s. If you wanna display a message to the visitor, use one of the many messagebox libraries. If you wanna do debugging, use console.log().
If you're looking for good information, the Mozilla developer network is a great resource:
Comments on this post
April 12th, 2013, 08:23 AM
Oh, I missed the localhost mention. Browsers tends to block scripts running locally. Do you want to circumvent the security or were you just looking for the reason?
[EDIT] Err, brain error, wrong forum, wrong language.
Last edited by Winters; April 12th, 2013 at 08:30 AM.
April 12th, 2013, 08:35 AM
He does get an alert box, it's just that there's some default text instead of the message.
Anyway, I think it's pretty useless to continue fumbling with that stuff. It's of no pratical use, and you don't learn anything from it. Just ignore it, p4aul.
April 12th, 2013, 10:33 AM
Thanks for all the replies. Actually what I was doig was trying out Marqetta and the tree widget from Dojo. When you click on a node you can cause an event and I just use that to open an Alert box to give some more info. I was using it to display a family tree. I'm surprised it worked actually because I (an most people) have popup windows blocked in their bnrowsers. Is there a fool-proof way to show more information that would not be blocked by a browser, say a widget from some library or other?
Originally Posted by Jacques1
April 12th, 2013, 10:41 AM