$w.onRead before ready

Hi,
Is there any way to do something as soon as the page is up, even before the page is loaded?

I want to make a redirect page but it takes to long because the wix page fully load before redirecting

My code:

import wixLocation from 'wix-location';

$w.onReady(function () {
wixLocation.to("mylink . com");
});

Edit:

  • the link is out of the website link (for example GitHub link) and I cannot use the 301 redirect for out of wix links

Please use 301 redirect. Or custom code under wix dashboard > settings

the link is out of the website link (for example github link) and I cannot use the 301 redirect for out of wix links

And I couldn’t find any way to do this with custom code