Skip to content

Instantly share code, notes, and snippets.

@0xkuj
Last active April 22, 2025 08:03
Show Gist options
  • Save 0xkuj/ff2d331c6b5b206463ba50038ad4c165 to your computer and use it in GitHub Desktop.
Save 0xkuj/ff2d331c6b5b206463ba50038ad4c165 to your computer and use it in GitHub Desktop.
SafariX tweak JS to fight back webkit issues on older iOS

SafariX JavaScript Fixes Collection

A collection of JavaScript fixes for various websites that can be used with SafariX tweak. Each fix includes a description of the issue it solves and the JavaScript code to fix it. To use it, go to SafariX settings -> JavaScript Injection -> add the domain as stated in this gist -> press on the domain -> enable subdomains if needed -> paste the js code into the text box below the toggle


ChatGPT Scroll Fix 1

iOS: 15/16

Domain: chatgpt.com

Issue: Unable to scroll through long responses, scroll gets stuck

Fix code:

(function() {
    // Allow scrolling on all possible containers
    const elements = [
        document.documentElement,
        document.body,
        document.querySelector('main'),
        document.querySelector('.overflow-hidden'),
        document.querySelector('[role="presentation"]'),
        ...document.querySelectorAll('.overflow-hidden'),
        ...document.querySelectorAll('[style*="overflow: hidden"]'),
        ...document.querySelectorAll('[style*="position: fixed"]')
    ];

    elements.forEach(el => {
        if (el) {
            el.style.cssText = `
                overflow: auto !important;
                position: relative !important;
                height: auto !important;
                max-height: none !important;
                overscroll-behavior: auto !important;
                -webkit-overflow-scrolling: touch !important;
            `;
        }
    });

    // Force layout recalculation
    window.dispatchEvent(new Event('resize'));

    // Remove any classes that might block scrolling
    document.querySelectorAll('*').forEach(el => {
        if (el.classList.contains('overflow-hidden')) {
            el.classList.remove('overflow-hidden');
        }
    });
})();

ChatGPT Scroll Fix 2

iOS: 15/16

Domain: chatgpt.com

Issue: Unable to scroll through long responses, scroll gets stuck

Fix code:

(function () {document.querySelectorAll(‘html *’).forEach(function(node) {var s = getComputedStyle(node);if (‘hidden’ === s[‘overflow’]) { node.style[‘overflow’] = ‘visible’; }});})();
@tyhallcsu
Copy link

Userscript Versions Available:

I’ve tested both scripts using [Tampermonkey](https://apps.apple.com/us/app/tampermonkey/id6738342400) on iOS 15.4.1, and they work perfectly.

Huge thanks to @0xkuj for the original JavaScript! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment