# Do old cut-and-paste scripts still work in current browsers?

Source: https://forum.codelifter.com/posts/do-old-cut-and-paste-scripts-still-work-in-current-browsers/
Site: CodeLifter Forum, category Script Shelf
Published: 2026-10-16. Updated: 2026-10-16. Replies: 0.

## Question by CodeLifter editors (staff), 2026-10-16

Some run unchanged, many half work, and a few fail without any error on screen. Plain DOM code usually still runs. What breaks is code that relied on things browsers now restrict or ignore: popups on page load, resizing the window, status bar text, late `document.write()` calls, `javascript:` links and scripts loaded over plain HTTP.

## Why "it runs" is not the same as "it works"

Old scripts rarely throw a red error. More often the browser accepts the call and does nothing, or does something different from 2003. Deprecated features are a good example. MDN marks [`document.write()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/write) as deprecated and strongly discouraged, yet it still writes into the page when called from an inline `<script>` while the page is loading. Call it after the page has loaded and it clears the document first. Call it from an `async` or `defer` script and it is ignored, with a console message. Same function, three outcomes, depending on when it runs.

## What happens to the common patterns now

| Old pattern | What a current browser does | Source | What to use instead |
|---|---|---|---|
| `window.status = "Welcome!"` | Nothing: the HTML standard requires that setting it has no effect on the status bar | [MDN, Window.status](https://developer.mozilla.org/en-US/docs/Web/API/Window/status) | Visible text on the page |
| `document.write()` after load or in an async script | Clears the page, or is ignored | MDN, Document.write | `createElement` and `append`, or `textContent` |
| `window.open()` on page load | Blocked: popups must open in direct response to user input, and `window.open` returns `null` when blocked | MDN, Window.open | A link, or a `<dialog>` inside the page |
| `window.resizeTo()` on the main window | Not allowed for a window or tab the page did not open with `window.open()`, or a window with several tabs | MDN, Window.resizeTo | Nothing; let the visitor size their window |
| `<a href="javascript:...">` | Runs on click, but misbehaves when copied, opened in a new tab, bookmarked, or when JavaScript fails | MDN, Window.open | A real `href`, with a click handler added on top |
| `<script src="http://...">` on an HTTPS page | Blocked as mixed content | [MDN, Mixed content](https://developer.mozilla.org/en-US/docs/Web/Security/Defenses/Mixed_content) | An HTTPS copy, or better, a local copy |
| `oncontextmenu="return false"` to stop right-click | Works for most clicks; Firefox shows the menu without firing the event on Shift plus right-click | MDN, contextmenu event | Nothing; it never protected the page |
| `onclick="history.back()"` | Does nothing if there is no previous page, for example in a new tab | MDN, History.back | A real link with a fallback address |

The last row is the pattern behind the old site's most searched tip. The reviewed replacement is on the [go back prompt page](https://codelifter.com/prompts/go-back/), which keeps a real link and uses history only for visitors who arrived from the same site.

## Check a script in ten minutes

1. Save the snippet into a local file, for example `test.html`, with nothing else on the page.
2. Serve the folder instead of opening the file directly, so it behaves like a real page: `python3 -m http.server 8000 --bind 127.0.0.1` from that folder (the `--bind` option binds it to localhost only, per the [Python http.server docs](https://docs.python.org/3/library/http.server.html), which also say the module is not for production), then open `http://localhost:8000/test.html`.
3. Open the browser's developer tools, switch to the Console tab and reload. Read every warning, not only the errors: blocked popups, ignored `document.write()` calls and mixed content all show up there.
4. Use the script with the keyboard alone. Tab to it, press Enter and Space. Most scripts from that era assumed a mouse.
5. Open the page in a new tab and from a bookmark. Anything that depends on history or `document.referrer` behaves differently there.
6. Turn on touch emulation in the developer tools and try again, since hover and mouse events do not map cleanly to touch.
7. Search the code for `innerHTML`, `document.write`, `eval` and `http://`. Each one is a reason to read that line twice.

If a script passes all seven, it works. If it fails one, decide whether the fix is a small edit or a rewrite.

## Fix, replace or retire

The Script Shelf sorts the old CodeLifter scripts into three groups, and the same split works for anything you find in an old tutorial:

- **Fix or rewrite** when the job is still useful and the code is short: a quote rotator, a slideshow, a draggable box.
- **Replace with the platform** when the browser now does the job: `input type="email"` instead of an email checker, CSS `scrollbar-color` instead of a scrollbar script, a `link rel="icon"` instead of a favicon script.
- **Retire** when the job itself was the problem: popups nobody asked for, window resizing, right-click blocking.

The [Script Shelf](https://codelifter.com/scripts/) lists which old scripts went where and why. For the separate question of whether pasting code from an old site is safe, rather than whether it runs, see [is it safe to paste a script from an old tutorial site](/posts/is-it-safe-to-paste-a-script-from-an-old-tutorial-site/). If the script you are looking at is a rollover, [the rollover thread](/posts/what-happened-to-the-old-image-rollover-script/) has a CSS replacement.

---
Cite as: CodeLifter Forum, "Do old cut-and-paste scripts still work in current browsers?", https://forum.codelifter.com/posts/do-old-cut-and-paste-scripts-still-work-in-current-browsers/, accessed 2026-10-16.
