Do old cut-and-paste scripts still work in current browsers?
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.
Cite
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.- CodeLifter editorsStaffStaff, CodeLifter ·
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()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 anasyncordeferscript 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 Visible text on the page document.write()after load or in an async scriptClears the page, or is ignored MDN, Document.write createElementandappend, ortextContentwindow.open()on page loadBlocked: popups must open in direct response to user input, and window.openreturnsnullwhen blockedMDN, Window.open A link, or a <dialog>inside the pagewindow.resizeTo()on the main windowNot allowed for a window or tab the page did not open with window.open(), or a window with several tabsMDN, 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 pageBlocked as mixed content MDN, Mixed content An HTTPS copy, or better, a local copy oncontextmenu="return false"to stop right-clickWorks 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, which keeps a real link and uses history only for visitors who arrived from the same site.
Check a script in ten minutes
- Save the snippet into a local file, for example
test.html, with nothing else on the page. - 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.1from that folder (the--bindoption binds it to localhost only, per the Python http.server docs, which also say the module is not for production), then openhttp://localhost:8000/test.html. - 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. - Use the script with the keyboard alone. Tab to it, press Enter and Space. Most scripts from that era assumed a mouse.
- Open the page in a new tab and from a bookmark. Anything that depends on history or
document.referrerbehaves differently there. - Turn on touch emulation in the developer tools and try again, since hover and mouse events do not map cleanly to touch.
- Search the code for
innerHTML,document.write,evalandhttp://. 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, CSSscrollbar-colorinstead of a scrollbar script, alink 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 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. If the script you are looking at is a rollover, the rollover thread has a CSS replacement.
- Save the snippet into a local file, for example
Write something first.
Give people something to work with: at least 30 words on what happened and what you tried.
That is too long. Keep it under 6,000 characters.
Write the question as the title, 15 to 140 characters, no links.
Pick a category.
Add a name (2 to 40 characters, no links).
That email address does not look right.
That was quick. Read the thread, then try again.
The form expired. Reload the page and post again.
Something went wrong with the form. Reload and try again.
Please complete the check and post again.
Limit reached for now. Try again later.
This thread is closed to new replies.
This thread no longer accepts replies.
Something went wrong with the form. Reload and try again.
Post a reply or question first (name and email), then this browser can vote, edit and accept answers.
You cannot vote on your own post.
Only the author (within 30 days) or the forum team can do that.
That email belongs to a forum team account. Use your sign-in link instead.
New accounts are paused for the moment. Try again later.
That was already posted.