Site VS Page Code VS Server Side executions

I’m looking for some insights on when to use site code vs page code.

It seems the page code loads first. Is this correct or can you make the site code load first?

Also, is there any support for server side coding.

The reason I’m asking these questions, I want to add another layer of authentication for my member’s area. Everything seems to work. However, timing and delays are an issue.

Essentially, I’m trying to emulate server side processing with client side code.

Right now, I’ve come to the conclusion, if I’m adding more authentication on the client side, it’s best handled by page code, even if it is used through out the members area.

Is this a good assumption?


Actually the site code runs first.
what are you trying to achieve? what kind of authentication?
Check out this article about server side code.

Do you mean server side code runs first or site code?

Some of the code that I wrote on the site code, I’m now moving to the page code. This could also be that it is still running as the page code is executed and the timing is off.

This is based on observation as opposed to documentation, which would be helpful, hence why I’m asking questions to better understand how things work.

Essentially, I’m building a portal that requires extra layers of permissions. For example, members can share access to their media and can invite others to the view the media.

Ideally, I would have everything executed on the backend before the header was even called. For example in PHP, I could do a redirect with out the page loading or I could re-use code and libraries. However, I believe that’s not how the backend for Wix generally works. It’s more to call APIs, not to execute database calls prior to the loading of a web page.

I also understand that there is a lot of benefit to moving some of the processing to the client side.

This thread is more to understand best practices. That said, every project is different and Wix is still evolving.

No, page code runs loads first. I need access to the site code panel so I can create a preloader