How To Remove An Error On A Page

Table of contents:

How To Remove An Error On A Page
How To Remove An Error On A Page

Video: How To Remove An Error On A Page

Video: How To Remove An Error On A Page
Video: How to Fix “Script Error” An Error Has Occurred In The Script On This Page In Windows PC 2024, November
Anonim

Very often programmers writing the code of the site pages forget to check what type of Internet browser (Internet Explorer, Mozilla, Opera, etc.) and version will be used to view the site. For error-free display of the page in all browsers, it is necessary to correct those parts of the page code where objects or methods specific to this or that Internet browser are used. Neglect or ignorance of these principles can lead to the fact that at the bottom of the browser window, on the left side of the status bar, an icon appears - a triangle with an exclamation mark, and the page being viewed is displayed and not working correctly. A few simple recommendations will allow developers to avoid such errors.

Fig. 1. Browser dialog box describing the error
Fig. 1. Browser dialog box describing the error

Necessary

Skills of working with html and JavaScript languages

Instructions

Step 1

First of all, you need to establish the cause and place of the error. To do this, click on the icon and in the dialog box that appears, click the "Show details" button. After that, it will be possible to view the error text and the line number of the page code containing the erroneous expression - Fig. 1. As a rule, these are JavaScript errors, and they are caused by trivial coding errors or by the fact that the syntax and supported functions and objects of this language are different in different Internet browsers.

Step 2

After reviewing the text of the error, you need to determine if this is a coding error or if it occurs because the Internet browser you are using or its current version does not support your JavaScript standard. It's easy to understand what type of error is - just open the page in different browsers. If the error occurs everywhere, then it is enough to simply fix the coding error. The most common errors of this kind are syntax and references to empty (non-existent) objects or methods.

Step 3

In the case when the error does not occur in all Internet browsers, it is necessary either to simplify the code by refusing to use special functions or objects that are specific only to JavaScript of the browser where the page is displayed without error, or add a check for the type of Internet browser and its version and depending on the result, call the appropriate methods or objects, or even use special syntax.

Here's a JavaScript snippet containing an example of a basic type and version of an internet browser:

if (Request. Browser. Browser == "IE" && Request. Browser. Version == "6.0")

{

rn_img. Style. Add ("background", "url (images / blank.gif)");

}

else

{

…..

}.

Recommended: