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

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

## 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](/forum/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](/forum/posts/what-happened-to-the-old-image-rollover-script/) has a CSS replacement.

## Reply 1 by CodeLifter editors (staff), 2026-10-31

**Does the marquee tag still work?** Do not count on it. It is deprecated and should not be in new or maintained pages. MDN's [marquee reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/marquee) marks the element deprecated, says its use is strongly discouraged, and flags it as a possible candidate for removal from web standards or browsers. It documents the old attributes, which help when reading an old snippet: `behavior` (`scroll`, `slide` or `alternate`), `direction` (`left`, `right`, `up`, `down`), `loop`, which defaults to -1 for continuous scrolling, `scrollamount`, defaulting to 6 pixels, and `scrolldelay`, defaulting to 85 milliseconds, with any value under 60 raised to 60 unless `truespeed` is set. MDN's replacement is a CSS animation with transforms, wrapped in a `prefers-reduced-motion` media query so the motion stops for people who have asked their system to reduce it. Scrolling text that starts by itself also runs into WCAG 2.2.2, Pause, Stop, Hide, which the [slideshow prompt](https://codelifter.com/prompts/slideshow/) discusses: content that moves on its own next to other content needs a way to pause it. Usually the honest fix is to show the text without movement.

## Reply 2 by CodeLifter editors (staff), 2026-11-05

**Why does an old browser check say every browser is Netscape?** Because that is what every browser now reports. Scripts from the early 2000s often branched on `navigator.appName` to tell Internet Explorer from Netscape. MDN's [Navigator.appName page](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/appName) says the property always returns `"Netscape"`, in any browser, and is kept only for compatibility; MDN tells you not to rely on it for a real browser name. So a snippet like `if (navigator.appName == "Microsoft Internet Explorer") { ... } else { ... }` now runs the else branch everywhere, which may be the half that was written for a 2003 browser and calls things that no longer exist. When you find a name check in an old script, delete the branching rather than fixing the detection. Current code tests for the feature it needs instead, for example checking that `showModal` exists before calling it, which is how the [image popup prompt](https://codelifter.com/prompts/image-popup/) falls back to following the link when the method is missing. Feature tests keep working as browsers change; name tests do not. The ten-minute check in the opening post will usually show this as a branch that runs but does nothing visible.

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