Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6095603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:49:48+00:00 2026-05-23T12:49:48+00:00

i need to run a java script only once when accessing the site for

  • 0

i need to run a java script only once when accessing the site for the first time..i want to save a cookie and check it every time site opening if cookie is saved dont need to run the script if cookie is not saved ( it mean first times that using the site ) need to create a new cookie and run the script.. Or we can do it from IP if that ip is on mysql database no to run if not add da ip and run the script.im new to php..still studying. need a help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:49:49+00:00Added an answer on May 23, 2026 at 12:49 pm

    In its simplest form:

    if (document.cookie != 'onetime=true') {
        ... do your one-time stuff here ...
        document.cookie = 'onetime=true; expires:Fri, 8 Jul 2011 00:00:00 UTC; path=/';
    } else {
        ... cookie is set, so don't do anyhing ...
    }
    

    This only allows a single cookie key=value pair, however. If your site requires other cookies beyond this one (e.g. a session token), you’ll need a bit of infrastructure to set/get/read multiple cookies. Code samples for that are demoed here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery script which I need to run only once everything else
I need to run a JavaScript function onLoad(), but only do it if the
I need to run 'free -m' every minute and then add the result to
I have a JavaScript method that I need to run on one of my
I need a Javascript application that, when run, prompts a password to be entered,
I need to run a stored procedure from a C# application. I use the
I need to run an equipment audit and to do that I need to
I need to run a Linux CLI command and get its stdout output from
I need to run a RLIKE query on a database mmoved from MySQL to
I need to run a native program and retrieve the output in an Adobe

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.