• Page 1 of 1
  • 1
Forum moderator: bigblog  
uCoz Community » For Webmasters » Design Customization » How to redirecting to file catalog
How to redirecting to file catalog
Harina
Posts: 44
Reputation: 0

Message # 1 | 1:37 PM
Hello there we want a users to be taken to a file catalog home page when they log on to site regardless which page they will log on from. Is this possible? Has anyone tried it on their site and was working? Thank you!
Soldierdevil
Posts: 142
Reputation: 0

Message # 2 | 3:22 AM
Harina,

Code
<?if($USER_LOGGED_IN$)?>
<script>
window.location.href = "http://yourdomain.com/load";
</script>
<?endif?>


I am not sure if you insert it on top of site it will work but it works at home page template. You might need to insert it manual in all codes.

I hate politics, people who do not make an effort with people and those who try hard to be cool
bigblog
JOE-vascript
Posts: 1617
Reputation: 73

Message # 3 | 8:54 PM
Soldierdevil, this will make all pages inaccessible for logged-in users, I'm not sure this is what OP wants. If that's the case, then your answer is good.

In all other cases, I'd suggest using cookies. The general idea is to have a cookie (let's call it "justLoggedIn") that would be checked upon by a script that will execute on every page load. If this cookie exists in the user's browser, then don't do anything. Otherwise, create the cookie and redirect the user to /load. If the user is logged out and the cookie exists, delete the cookie and redirect to whatever page (/, for example).

Harina, if this is what you have in mind, let me know and I'll try to help you write this script for your website.

Quote Soldierdevil ()
I am not sure if you insert it on top of site it will work but it works at home page template. You might need to insert it manual in all codes.

Should work in global blocks, if that's what you mean.

hey i'm joe and i do not work for the company anymore, sorry for the late replies
icon by ch-chau

I'm still here for some godforsaken reason
Harina
Posts: 44
Reputation: 0

Message # 4 | 1:31 AM
bigblog, yes please help me with my site everywhere and i am paying. I want my site to work on some way but i cant make it work because i dont know making sites well. Please send me a contact
bigblog
JOE-vascript
Posts: 1617
Reputation: 73

Message # 5 | 11:37 PM
Harina, this should do the job:
Code
<script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
<script type="text/javascript">
  window.onload = function () {
  <?if($USER_LOGGED_IN$)?>
    if (!Cookies.get('uuser_logged_in')) {
      Cookies.set('uuser_logged_in', 1, { expires: 365 } );
      window.location.href = '/load';
    }
  <?else?>
    if (Cookies.get('uuser_logged_in')) {
      Cookies.remove('uuser_logged_in');
    }
  <?endif?>
  }
</script>


place this in the Bottom part of the website global template

hey i'm joe and i do not work for the company anymore, sorry for the late replies
icon by ch-chau

I'm still here for some godforsaken reason
uCoz Community » For Webmasters » Design Customization » How to redirecting to file catalog
  • Page 1 of 1
  • 1
Search: