0

When I put code on console (F12) on normal page this code works, normally has https:// address. But when it comes to local file or when i open pdf on browser, the F12 code doent work, but when you inspect its own devtool which it popup, eg. file:///C:/Users/Downloads/NPL/work.pdf it works. But wondering how can i do that or execute it instead on popup.js so can i just click it without inspecting, to auto scroll that page of pdf.

This my code. And want this execute also this on that page like that too..

// Auto-scroll function
function autoScroll() {
    // Adjust scroll speed by changing the value inside setInterval (milliseconds)
    let scrollInterval = setInterval(() => {
        window.scrollBy(0, 10); // Adjust the scroll amount (vertical scroll)
        // Condition to stop scrolling (example: scroll to 1000px)
        if (window.scrollY >= 1000) {
            clearInterval(scrollInterval); // Stop scrolling
        }
    }, 100); // Adjust the interval for smoother or faster scrolling
}

// Call autoScroll function to start scrolling
autoScroll();

Tried check Allow access to file URLs, but can't. I think this manifest.json will do that for that permission.. Expecting for simple code for popup.js and manifest,json. Hope you have.. Tried also this, permissions": [ "activeTab", "declarativeContent" ], but cant still.. Graci

2
  • 1
    The built-in PDF viewer is displayed inside a hidden embedded iframe, so the only way to scroll it is to use an external utility (like AutoHotkey) that sends PageDown hotkey periodically.
    – woxxom
    Commented Jul 8 at 10:02
  • yes doing am doing that, ok, for AHK, i can auto scroll on it, but.. if switch or click other tab is stops. what may code for AHK to just throw an autoscroll like content js type. in short, it keeps scrolling while you focus on another or leave that tab scrolling?
    – Iso I
    Commented Jul 8 at 12:11

0