(logo)  Browser Extensions JavaScript Test

This page tests AWeb's browser extension JavaScript APIs (window, document, forms, events, etc.). For ECMAScript 3 core language tests, see ecmascript_test.html. Each test includes a description of what it tests, how to run it, what results you should expect, and the interactive test itself. Deliberately broken handlers and scripts are in Graceful Failure.


Quick Navigation

Window Object | Document Object | History Object | Navigator Object | Location Object | HTML Forms | Window Methods | Image Constructor | XMLHttpRequest | Event Handlers | Graceful Failure | Compatibility Notes

Window Object

JS1: window.alert()

What it tests: The window.alert() method displays a modal alert dialog with a message.

How to run: Click the "Test Alert" button below.

Expected results: A dialog box should appear with the message "This is a JavaScript alert dialog!". Click OK to dismiss it.

Test:

JS2: window.confirm()

What it tests: The window.confirm() method displays a modal confirmation dialog with OK and Cancel buttons.

How to run: Click the "Test Confirm" button below.

Expected results: A dialog box should appear asking "Do you want to continue?" with OK and Cancel buttons. After clicking either button, check the status bar at the bottom of the browser window - it should show "You clicked OK" or "You clicked Cancel" depending on your choice.

Test:

JS3: window.prompt()

What it tests: The window.prompt() method displays a modal dialog with a text input field.

How to run: Click the "Test Prompt" button below.

Expected results: A dialog box should appear asking "What is your name?" with a text field pre-filled with "Guest". Enter a name and click OK, or click Cancel. The status bar should show "Hello, [your name]!" if you entered a name, or "No name entered" if you clicked Cancel.

Test:

JS4: window.status and window.defaultStatus

What it tests: The window.status property controls the status bar text, and window.defaultStatus sets the default status bar text.

How to run: Look at the status bar at the bottom of the browser window. It should show "JavaScript Test Page Loaded" when the page loads.

Expected results: The status bar should display the default message. When you hover over links or interact with elements that change the status, the status bar text should update accordingly.

JS5: window.setTimeout()

What it tests: The window.setTimeout() method executes a function after a specified delay in milliseconds.

How to run: Click the "Test Timeout" button below.

Expected results: The status bar should immediately show "Status will clear in 3 seconds...". After 3 seconds, the status bar should clear (become empty).

Test:

JS6: window.setInterval() and window.clearInterval()

What it tests: The window.setInterval() method repeatedly executes a function at specified intervals, and window.clearInterval() stops the interval.

Status: NOT SUPPORTED - AWeb only supports setTimeout() and clearTimeout(). setInterval() and clearInterval() are not available.

Note: To achieve similar functionality, you can use setTimeout() recursively.

JS7: window.open()

What it tests: The window.open() method opens a new browser window.

How to run: Click the "Open New Window" button below.

Expected results: A new window should open loading marquee_test.html (if not blocked by browser settings). The status bar should show "New window opened" if successful, or "Window blocked or failed" if the window could not be opened. Note: AWeb may block popup windows depending on settings.

Test:

JS8: window.close()

What it tests: The window.close() method attempts to close the current window.

How to run: Click the "Close Window" button below.

Expected results: The window may or may not close depending on browser security settings. The status bar should show "Window close attempted" or "Window cannot be closed (may require user interaction)". Note: AWeb typically only allows closing windows that were opened by JavaScript.

Test:

Not Supported

Back to top


Document Object

JS9: document.write()

What it tests: The document.write() method writes HTML content to the document.

How to run: Click the "Test document.write()" button below.

Expected results: The current page should be replaced with new content showing "Dynamic Content" as a heading, a paragraph explaining it was written by JavaScript, and the current date and time. This demonstrates that document.write() can dynamically generate HTML content.

Test:

JS10: Document Properties

What it tests: The document.title, document.URL, document.lastModified properties, and the document.forms[], document.images[], document.links[] arrays.

How to run: Click the "Show Document Info" button below.

Expected results: An alert dialog should appear showing the document title, URL, last modified date, and counts of forms, images, and links on the page.

Test:

JS11: Document Element Arrays

What it tests: The document.forms[], document.images[], and document.links[] arrays that contain references to all forms, images, and links on the page.

How to run: Click the "Count Elements" button below.

Expected results: An alert dialog should appear showing the number of images, forms, and links found on this page. The counts should match the actual elements present.

Test:

JS12: document.getElementById()

What it tests: The document.getElementById() method retrieves an element by its ID attribute.

How to run: Click the "Test getElementById" button below.

Expected results: The status bar should show "Element found (getElementById is supported)" if the method works, or "Element not found (getElementById may not be supported)" if it doesn't. Note: getElementById() may have limited support in AWeb's JavaScript implementation.

Test:
This is a test div element. Click the button to test getElementById.

JS13: document.writeln()

What it tests: The document.writeln() method writes HTML content to the document with a newline after each write.

How to run: Click the "Test document.writeln()" button below.

Expected results: The current page should be replaced with new content written using writeln(). This is similar to document.write() but adds newlines.

Test:

JS14: document.cookie

What it tests: The document.cookie property for reading and writing cookies.

How to run: Click the "Test document.cookie" button below.

Expected results: An alert dialog should appear showing that a cookie was set and then read back. The cookie value should match what was set.

Test:

JS15: Document Collections (anchors, applets, embeds)

What it tests: The document.anchors[], document.applets[], and document.embeds[] arrays.

How to run: Click the "Test Document Collections" button below.

Expected results: An alert dialog should appear showing the count of forms, links, images, anchors, applets, and embeds on the page.

Test:

Not Supported

Back to top


History Object

JS16: history.back()

What it tests: The history.back() method navigates to the previous page in the browser history.

How to run: First navigate to another page, then come back to this page. Then click the "History Back" button below.

Expected results: The browser should navigate to the previous page in the history (if one exists). This is equivalent to clicking the browser's back button.

Test:

JS17: history.forward()

What it tests: The history.forward() method navigates to the next page in the browser history.

How to run: After using history.back(), click the "History Forward" button below.

Expected results: The browser should navigate to the next page in the history (if one exists). This is equivalent to clicking the browser's forward button.

Test:

JS18: history.go()

What it tests: The history.go() method navigates to a specific position in the browser history. Positive numbers go forward, negative numbers go back.

How to run: Click either "Go Back 2" or "Go Forward 2" button below.

Expected results: The browser should navigate 2 pages back or forward in the history (if those pages exist).

Test:

JS19: history.length

What it tests: The history.length property returns the number of entries in the browser history.

How to run: Click the "Show History Info" button below.

Expected results: An alert dialog should appear showing the number of pages in the browser history. The number should be greater than 0.

Test:

Back to top


Navigator Object

JS20: Navigator Properties

What it tests: The navigator object properties that provide information about the browser and platform.

How to run: Click the "Show Navigator Info" button below.

Expected results: An alert dialog should appear showing:

Test:

JS21: navigator.userAgent (Displayed)

What it tests: The navigator.userAgent property displayed directly in the page.

How to run: Look at the text below - it displays automatically when the page loads.

Expected results: You should see the user agent string displayed in the test area below.

Test Output:
User Agent:

Back to top


Location Object

JS22: Location Properties

What it tests: The location object properties that provide information about the current page URL.

How to run: Click the "Show Location Info" button below.

Expected results: An alert dialog should appear showing:

Test:

JS23: location.href (Displayed)

What it tests: The location.href property displayed directly in the page.

How to run: Look at the text below - it displays automatically when the page loads.

Expected results: You should see the current page URL displayed in the test area below.

Test Output:
Current URL:

JS24: location.reload()

What it tests: The location.reload() method reloads the current page.

How to run: Click the "Reload Page" button below.

Expected results: A confirmation dialog should appear asking "Reload this page?". If you click OK, the page should reload. If you click Cancel, nothing should happen.

Test:

JS25: location.replace()

What it tests: The location.replace() method replaces the current page in history (doesn't create a new history entry).

How to run: Click the "Test location.replace()" button below.

Expected results: A confirmation dialog should appear. If you click OK, the page should reload using replace() instead of reload(). This means the back button won't go to the previous page.

Test:

Back to top


Note: Core ECMAScript 3 language features (String, Array, Math, Date methods) are tested in ecmascript_test.html. This page focuses only on browser extension APIs.

Back to top


HTML Forms

JS26: Form Properties

What it tests: Form object properties including name, action, method, encoding, target, and length.

How to run: Click the "Test Form Properties" button below.

Expected results: An alert dialog should appear showing the values of all form properties for the first form on the page.

Test:

JS27: Form Methods

What it tests: Form object methods including reset() and submit().

How to run: Click either the "Test Form.reset()" or "Test Form.submit()" button below.

Expected results:

Test:

JS28: Input Properties

What it tests: Input object properties including type, value, and defaultValue.

How to run: Click the "Test Input Properties" button below.

Expected results: An alert dialog should appear showing the type, value, and defaultValue of the first input field in the form.

Test:

JS29: Input Methods

What it tests: Input object methods including focus(), blur(), and select().

How to run: Click the "Test Input Methods" button below.

Expected results: The first input field should receive focus, and after 1 second, its text should be selected. Check the status bar for messages.

Test:

JS30: Select Properties

What it tests: Select object properties including length and selectedIndex.

How to run: Click the "Test Select Properties" button below.

Expected results: An alert dialog should appear showing the length and selectedIndex of the first SELECT element in the form.

Test:

JS31: Option Properties

What it tests: Option object properties including text, value, selected, defaultSelected, and index.

How to run: Click the "Test Option Properties" button below.

Expected results: An alert dialog should appear showing the properties of the first option in the first SELECT element.

Test:

Back to top


Window Methods

JS32: window.focus()

What it tests: The window.focus() method brings the window to the front and gives it focus.

How to run: Click the "Test window.focus()" button below.

Expected results: The window should receive focus and the status bar should show "Window focus() method called".

Test:

JS33: window.blur()

What it tests: The window.blur() method removes focus from the window.

How to run: Click the "Test window.blur()" button below.

Expected results: The window should lose focus and the status bar should show "Window blur() method called".

Test:

JS34: window.scroll()

What it tests: The window.scroll() method scrolls the window to a specific position.

How to run: Scroll down the page, then click the "Test window.scroll()" button below.

Expected results: The window should scroll to the top (position 0,0) and the status bar should show "Window scroll(0, 0) method called".

Test:

Back to top


Image Constructor

JS35: Image() Constructor

What it tests: The Image() constructor creates a new Image object that can be used to preload images.

How to run: Click the "Test Image Constructor" button below.

Expected results: An alert dialog should appear showing that an Image object was created with properties for src, width, and height.

Test:

Back to top


XMLHttpRequest (AJAX)

Note: XMLHttpRequest is a browser extension API that allows JavaScript to make HTTP requests without reloading the page. This enables AJAX (Asynchronous JavaScript and XML) functionality.

JS36: XMLHttpRequest Constructor

What it tests: The XMLHttpRequest() constructor creates a new XMLHttpRequest object.

How to run: Click the "Test XMLHttpRequest Constructor" button below.

Expected results: The status bar should show "XMLHttpRequest opened (GET xhr_test_data.html)" if the constructor works. This demonstrates that XMLHttpRequest is available as a global constructor.

Test:

JS37: XMLHttpRequest GET Request

What it tests: The XMLHttpRequest open(), send(), and onreadystatechange methods for making asynchronous GET requests.

How to run: Click the "Test XHR GET Request" button below.

Expected results: The status bar should show "XHR request sent..." immediately, then "XHR request completed successfully! Status: 200" when the request completes. The response content should appear in the result area below.

Test:


Response will appear here after clicking the button above.

JS38: XMLHttpRequest JSON Request

What it tests: XMLHttpRequest can fetch JSON data files.

How to run: Click the "Test XHR JSON Request" button below.

Expected results: The status bar should show "JSON XHR request sent..." then "JSON XHR request completed! Status: 200" when done. The JSON content should appear in the result area below.

Test:


JSON response will appear here after clicking the button above.

JS39: XMLHttpRequest Properties

What it tests: The readyState, status, statusText, and responseText properties of XMLHttpRequest.

How to run: Click the "Test XHR Properties" button below.

Expected results: An alert dialog should appear showing the current values of XHR properties. readyState should be 0 (UNSENT) before opening, and status/statusText may be 0/empty until a request is made.

Test:

JS40: XMLHttpRequest readyState Changes

What it tests: The onreadystatechange event handler and the readyState property transitions (0=UNSENT, 1=OPENED, 2=HEADERS_RECEIVED, 3=LOADING, 4=DONE).

How to run: Click the "Test XHR readyState" button below.

Expected results: The status bar should show "XHR readyState test started...". When the request completes, an alert should appear showing all readyState transitions that occurred (typically 1, 2, 3, 4).

Test:

JS41: XMLHttpRequest Response Headers

What it tests: The getAllResponseHeaders() method to retrieve all HTTP response headers.

How to run: Click the "Test XHR Headers" button below.

Expected results: The status bar should show "XHR headers test started...". When the request completes, an alert should appear showing all HTTP response headers (Content-Type, Content-Length, etc.).

Test:

JS42: XMLHttpRequest abort()

What it tests: The abort() method to cancel an in-progress XMLHttpRequest.

How to run: Click the "Test XHR Abort" button below.

Expected results: The status bar should show "XHR request sent, will abort in 1 second..." immediately, then "XHR request aborted!" after 1 second. The request should be cancelled before it completes.

Test:

Not Yet Supported

Back to top


Event Handlers

JS43: ONMOUSEOVER and ONMOUSEOUT

What it tests: Mouse event handlers that trigger when the mouse moves over or away from an element.

How to run: Move your mouse over the link below, then move it away.

Expected results: When you move the mouse over the link, the status bar should show "Mouse is over the link!". When you move the mouse away, the status bar should clear.

Test:
Hover over this link - watch the status bar!

JS44: ONCLICK

What it tests: The ONCLICK event handler that triggers when an element is clicked.

How to run: Click any of the test buttons on this page - they all use ONCLICK handlers.

Expected results: When you click a button, the associated JavaScript function should execute. For example, clicking "Test Alert" should show an alert dialog.

JS45: ONCLICK for Buttons Outside Forms

What it tests: The ONCLICK event handler works for input buttons that are not inside a form element.

How to run: Click the button below (it's outside any form).

Expected results: The status bar should show "Formless input button clicked! This button works outside a form." This demonstrates that AWeb supports formless input elements for JavaScript events.

Test:

JS46: ONCLICK for Images

What it tests: The ONCLICK event handler works for IMG elements.

How to run: Click the image below.

Expected results: An alert dialog should appear saying "Image onclick handler works! This demonstrates onclick support for IMG tags."

Test:
(logo)
Click the image above

JS47: ONCLICK for Objects

What it tests: The ONCLICK event handler works for OBJECT elements.

How to run: Click the object below.

Expected results: An alert dialog should appear saying "Object onclick handler works! This demonstrates onclick support for OBJECT tags."

Test:
(logo)
Click the object above

JS48: ONFOCUS and ONBLUR

What it tests: Focus event handlers that trigger when a form field gains or loses keyboard focus.

How to run: Click in the text field in JS50 below, then click outside of it.

Expected results: When you click in the field (giving it focus), the status bar should show "Field focused: name". When you click outside (blur), the status bar should show "Field blurred: name".

JS49: ONCHANGE

What it tests: The ONCHANGE event handler that triggers when a form field value changes.

How to run: Type something in the text field in JS50 below, then click outside the field or press Tab.

Expected results: After you change the text and move away from the field, the status bar should show "Field changed: [your text]".

JS50: ONSUBMIT and ONRESET

What it tests: Form event handlers that trigger when a form is submitted or reset.

How to run: Try submitting the form below (leave the name field empty to test validation), or click the Reset button.

Expected results:

Test:

Name:

Sample SELECT (for select/option API tests):

JS51: ONLOAD

What it tests: The ONLOAD event handler that triggers when the page finishes loading.

How to run: This test runs automatically when the page loads. Check the status bar.

Expected results: When the page loads, the status bar should at least show "JavaScript Test Page Loaded" (BODY ONLOAD). If the host maps defaultStatus only indirectly, BODY also sets window.status. After all scripts run, window.onload may replace the message with the compatibility summary string.

JS52: ONUNLOAD

What it tests: The ONUNLOAD event handler that triggers when the page is unloaded (user navigates away).

How to run: Navigate away from this page (click a link or use the back button).

Expected results: When you leave the page, the onunload handler should execute. Check the status bar or look for any alert that appears.

JS53: ONERROR and ONABORT (Image Events)

What it tests: The ONERROR and ONABORT event handlers for image loading errors and aborts.

How to run: The test image below has onerror and onabort handlers. If the image fails to load, onerror will trigger. If loading is aborted, onabort will trigger.

Expected results: If the image fails to load, the status bar should show "Image onerror handler triggered" (instead of an alert to avoid interrupting page load). If loading is aborted, the status bar should show "Image onabort handler triggered".

Test:
(test image)
This image may not exist, triggering onerror - check the status bar

JS54: ONSELECT

What it tests: The ONSELECT event handler that triggers when text in an input field is selected.

How to run: Select text in the input field in JS50 above (click and drag to select).

Expected results: When you select text in the input field, the status bar should show "onselect event triggered - text was selected".

Partially Supported

Not Supported

Back to top


Graceful Failure (Browser Extension APIs)

These tests use deliberately broken handlers or scripts. The browser should not crash; content after an error should still load. Interactive rows describe the expected (non-fatal) outcome.

JS55: Invalid ONCLICK attribute expression — EXPECT: no crash; button may do nothing

What it tests: Event handler attribute with JavaScript syntax errors.

Expected results: Clicking the button must not hang or crash the browser. Status text may be unchanged.

Test:

JS56: Valid ONCLICK after invalid neighbor — EXPECT: this handler still runs

What it tests: Isolation between adjacent controls when one handler is invalid.

Expected results: This button should set the status bar to a known message when clicked.

Test:

JS57: SCRIPT block with parse error — EXPECT: later markup still renders

What it tests: A SCRIPT element whose source does not parse; following BODY content must still appear.

Expected results: You must see the green confirmation line below even though the script above is invalid.

Test:

If this line is visible, markup after the broken SCRIPT rendered successfully.

JS58: Missing SCRIPT SRC — EXPECT: no crash (network error handled)

What it tests: SCRIPT with SRC pointing at a non-existent file.

Expected results: Page remains usable; optional console or status noise is acceptable.

Test:

JS58 footer: body content after missing SCRIPT SRC.

Back to top


Compatibility Summary

Browser Extension Features Fully Supported

Note: For ECMAScript 3 core language features (String, Array, Math, Date methods), see ecmascript_test.html.

Browser Extension Features Partially Supported

Browser Extension Features Not Supported

Browser Extensions Compatibility Notes

AWeb implements browser extension JavaScript APIs with support for window, document, history, navigator, location, forms, and event handlers. For ECMAScript 3 core language features, see ecmascript_test.html.

Back to top


Last Updated: 2026 - AWeb 3 Browser Extensions JavaScript Test

ECMAScript 3 Core Language Tests | Back to AWeb documentation index