Excute a JS

problem: I want to resize the whole text/body after browser open
this what I found from another source

( document ).ready( function() {
            var $body = $('body'); 
            var setBodyScale = function() {
                var scaleSource = $body.width(),
                    scaleFactor = 0.35,                     
                    maxScale = 600,
                    minScale = 30; 
                var fontSize = scaleSource * scaleFactor;
                if (fontSize > maxScale) fontSize = maxScale;
                if (fontSize < minScale) fontSize = minScale;
                $('body').css('font-size', fontSize + '%');
            }
            $(window).resize(function(){
                setBodyScale();
            });            
            setBodyScale();
        });

How can I use this code or anything similar in Excute JS block?

This Is How It looks Like By Default

This Is What I Need

Any help will be appreciated

Your code triggers on the document.ready event. If your page is already loaded it won’t trigger.
Take the part inside the function and run that one directly using the execute js block.

var $body = $('body'); 
            var setBodyScale = function() {
                var scaleSource = $body.width(),
                    scaleFactor = 0.35,                     
                    maxScale = 600,
                    minScale = 30; 
                var fontSize = scaleSource * scaleFactor;
                if (fontSize > maxScale) fontSize = maxScale;
                if (fontSize < minScale) fontSize = minScale;
                $('body').css('font-size', fontSize + '%');
            }
            $(window).resize(function(){
                setBodyScale();
            });            
            setBodyScale();

ERROR: javascript error: Unexpected identifier

shows above errror

Try to run it directly in the js console of the browser so you get a more insightful error message with the line etc.

code runs perfectly on console but not in Excute JS block

@Ruri Sorry If I distrubs

The code runs good in browser console but in Execute JS block it throws error
any solution
or any similar method to obtain it

Thank you

Are you using the executejs block of puppeteer (and not the script block)? Can you confirm you’re on OB2?