Dead Button on Web Page (JavaScript/HTML) - php

Does anyone know why a button would stop working? There's an onclick javascript event attached to it, and when I click it, I don't see the alert saying that it has fired. For all intents and purposes, it's dead.
What I am asking is what are some of the causes of this?
I had this happen on a seperate section of the same page, and found I had a curly brace missing, and I have gone through the code where the broken button resides and there is not an issue with the curly braces. I'm not missing semicolons either. I know you all will want to see code, but all I am asking about is if someone has had this happen and what was the cause or what were the causes of it happening.
I've already used http://www.javascriptlint.com to comb through the code.
Thanks,
Waddler.

This happens in some browsers as they are unable to understand certain versions of javascript. This could be a browser workaround issue. Try testing in multiple browsers.

Javascript has a tendency to stop working when it encounters an error. You may have an error on your page that's not directly related to the code that's no longer running but is preventing it from ever being executed.
You should install a tool like Firebug in Firefox or use one of the other browser's developer's tools. In firebug, if you run your page with the console open you can see a log of any javascript errors that are encountered and find out if that's the case. It also allows you to debug the code by setting a breakpoint and following the execution line-by-line and find out if something's not happening the way you expect.

You didn't post any code snippets, so it's hard to help when you don't show us anything.
Only advice I can give you: If you are in Chrome or FireFox, Press Ctrl+Shift+J to pull up the error console in order to see what the error is.

Related

net:err_connection_reset after loading php file completely

I have a quite simple php page (PHP 5.5.35 on CentOS 5.11) that queries a MySQL database. The resulting page shows completely, including the footer I include as a final instruction, so the PHP script runs entirely without error.
Almost every images and js libraries are loaded. However, there are two elements that are never loaded, an image and a jquery library. Each time and with any browser, those elements generate a (in Chrome, for instance) :
Failed to load ressource : net::ERR_CONNECTION_RESET
For testing purpose, I tried to delete those element from the page, ultimately, it is the favicon that can't be loaded. So it seems not to be those elements in particular. The connection seems to be reseted at some point between the PHP script completion and the page loading… and I don't have the beginning of any clue where I should start the troubleshoot.
Some other informations :
Apache logs don't log anything !
The other pages of the site works well
The site works without any problem on my local machine (Mac OS X, PHP 5.5.35 too)
Once the page is loaded, if I click any link on it, it shows a "Connection reseted" error page.
Does anybody have a clue, anything about where to start my search ? Thanks in advance, I am starting to desperate.
It happened that after searching everywhere, the cause was simply that I was handling a lot of parameters through GET – too many of them. I changed the code for using POST and everything worked miraculously… Hope it may help someone, sometime !

Why a Dojo app could be trying to retrieve files erroneously from googleapis in Firefox and not in Chrome?

I'm maintaining an old PHP app that is using Dojo. On Chrome all load well but on Firefox four "404 Not Found" error happened in a loop. The error happens while Firefox try to get the following files:
http://ajax.googleapis.com/ajax/libs/dojo/1.5.1/src/namespaces/dojo.js
http://ajax.googleapis.com/ajax/libs/dojo/1.5.1/src/namespaces.js
http://ajax.googleapis.com/ajax/libs/dojo/1.5.1/src/__package__.js
http://ajax.googleapis.com/ajax/libs/dojo/1.5.1/src.js
I said a loop because after the last error, Firefox try to get the first one again, then the second one again and so on infinitely.
What can be causing such estrange behavior?
I know that this could sound odd, but after disable the Awesome Screenshot Plus Firefox Add-On the problem disappear.
I get to this solution because beside this strange problem, I saw some request to superfish.com while accessing to the pages of this application, and that hasn't sense. Some guys over there said that such requests to superfish.com could related with the presence of some Add-On, then, I begin to disable Add-On until find out what was the problematic Add-On.
I hope this can help some body that get in my same situation.

Chat not working and firebug isn't helping

Clearly I must be doing something wrong with firebug because when I went to inspect my code I could not see any errors on anything. I know my code is not perfect, mainly because its an ajax chat and there's no chat going on. Maybe I'm utilizing it wrong, but I checked "All", "errors" and "warnings" for my website page which is here and I got nothing returned. I have just started using firebug as well as programming as a whole so Im sure I'm missing something. It would be very grateful for any tips or pointers on what I could do to be better.
If you look on the network tab, and try to add a login, says your php script is missing:
"NetworkError: 404 Not Found - http://www.entrilab.com/chatroom/php/ajax.php?action=login"

Browser compatibility issues with PHP website

I have a website called www.kratosguide.com.
The site works as expected for approximately 90% of users, however, I have been getting a LOT of complaints recently that the page doesn't load completely in certain browsers such as chrome/firefox/opera.
Here is a screenshot that someone sent me of how the page loads: http://i.imgur.com/sqNX4.jpg
It appears that only the header and footer is loading and the content from index.php is not.
http://www.reddit.com/r/productivity/comments/w1y30/16_habits_you_should_do_everyday/
Here is a link that demonstrates a user stating the issue above -- (4th comment down).
My host is unable to replicate the issue on their end and they say it works fine. My friend kept refreshing his page cache and he could replicate the error but only intermittently.
Thanks in advance.
***EDIT: I forgot to mention the site runs on WordPress, also the site works fine for me in every browser, which makes it hard for me to see where the problem is coming from.
Check the console. You have some errors
Uncaught ReferenceError: jQuery is not defined - 068690ea.84e407.js:24
Probably caused by this script being called before the jquery library.
It's difficult to tell what is causing the error without being able to replicate it. I'd try to load it in various browsers and see if I can get it to do that. Then take a look at the console for any errors and inspect the DOM to see if the content even loads.
Yes, I still see the errors in the log.
Let me be clearer.
For me the web page loads and is visible 100%, but when I look at the console I see what is shown below. This is an indication you have a problem. My personal settings allow me to see the page but with different settings or plugins I would not be able to see the page. You need to fix your XSS error.
You can reproduce the problem yourself!
Download chrome (or firefox) and then load the page, look at the console, see the error.
Then fix it.
Original answer below
First step, fix these errors shown by chrome. Looks like you have a XSS error.
I saw over 1200 unused CSS element on your page. Try to optimize the amount of data a user has to download to see your website. I had similar issues with my site and I realized how much stuff users had to load to see my website.
I tested it under Firefox, Chrome, IE7+. I didn't get any issues.
You seems to be using WordPress so you might want to check the WordPress community for similar problem.

How to put debug point

I've a php file calling another php file which sometimes calls another php file to execute some actions (all through ajax).
What I use to do was to echo at different points to know upto where the codes are executing properly. But with this approach, I can keep echo-ing.
So how do I know upto where my code is executing?? Is there a tool for Google Chrome browser to detect it??
In your web browser, click the wrench icon, then "Tools", then "Developer tools". You can debug and step through JavaScript, you can see a timeline of requests with the request and response headers and bodies fully inspectable, etc. You should be able to debug all your AJAX request without any additional software/plugins.
Firebug plugin for Firefox allows you to put actual debug breakpoints and step through the code - much easier to debug javascript than echo'ing
If you look on how to set a debugging environent with PHP, you'll find a lot of dead ends, trust me, I did. Therefore you've got 2 choices.
A: Keep echo-ing which will leave a trail of painful echo's in your code.
B: Use a logger. I've used for a while FirePHP, which comes as a FireBug extension and lets you send debugging messages to the browser, which is ideal for debugging Javascript based apps with heavy Ajax.
Hope I can help!
The technique you're using is called bullet tracing. There's no real way to track which code executes and when within an php file (like breakpoints) but you can pinpoint points of errors on lines of code as provided by the php debugger.
When AJAX requests are made, you can track the progress through XMLHttpRequest States. To check the headers and payload of the packets being sent, you could use Firebug in Firefox 3.6.x, Firefox 4 Beta's built-in developer console, or Google Chrome's developer console. (Packet sniffers also work)

Categories