PHP OR JAVASCRIPT QUESTION?

Question by kazyboi1994:
php or javascript question?
write, state that i put a google adsense script and a user somehow blocks adverts, how can i get php/javascript to know a script aint working?
———————————————————————————————————-
also if i have a frame that loads a page and it has an error, how can i tell php/javascript that
one second one, i mean, if the page fails to load/ the page doesnt exist, e.g http://ggoogle.co.uk/
——————————————
Answer by Makoto Yoshimoto
look into error checking. something like:
On Error Goto $ myLabel
in Visual Basic 6
——————————————
Know better? Leave your own answer in the comments!









about 2 years ago
It means you’re spending too much time online and need to get a real life. haha. :~) just kidding
about 2 years ago
un-install the messenger
then install this 1
http://a3.msg.sc5.yahoo.com/download.php...
the yahoo messenger 8.0 sux
this is the classic uncorruopted 7.5 version hope it helps
about 1 year ago
1) You can’t, really. If they block scripts, then scripts can’t run to tell the other scripts they’re blocked. If they don’t block scripts, you don’t have a problem. You’re sort of stuck with what the user wants. You can check if a user has javascript enabled (or it is supported) in a variety of ways. One is to check the browser’s capabilities via something like get_browser: http://us.php.net/manual/en/function.get-browser.php
Another is to create a javascript script to ping the server to tell it javascript is enabled. You can also modify the page data with javascript itself, and process that data server-side. It depends on what you’re going for, really.
If you just want to check if a single script is working, then you’ll have to set up a page which records each -successful- script execution, modify the script in question to ping that page when it runs, and then perform whatever error action you wish if the page doesn’t receive an expected ping.
In general, though, if you have to ask how to do it, you probably aren’t doing anything complicated enough to warrant it. I would advise against using any of these… just throw the page out there and let the user interact with it how he/she wishes.
2) You will have to request the page via php first, and check the HTTP code. Take a look at curl: http://us.php.net/curl
Grab the page, check if the http code is a success (200, 302, etc) or a failure (404, 500, etc). If it’s successful, then add the frame with the page’s content inside. If not, display an error.
You -could- also do this with javascript, but it’d be easier with php.
Best of Luck