Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. can we check that page is refresh using javascript

can we check that page is refresh using javascript

Scheduled Pinned Locked Moved ASP.NET
javascriptquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yrishi
    wrote on last edited by
    #1

    Hi, I have some code in javascript, which i dont want to execute on page refresh. How can i check that page is refresh using javascript Thanks in advance Yrishi

    A A 2 Replies Last reply
    0
    • Y yrishi

      Hi, I have some code in javascript, which i dont want to execute on page refresh. How can i check that page is refresh using javascript Thanks in advance Yrishi

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      Page refresh means the page will be again retrieved from the server. If one presses ctrl +f5 it will even remove browser cache and then load everything. so if you want to restrict running a function on page refresh, it will automatically blocked on first run, as it would be unable to check if it is run first or refreshed. One thing that you can do, is set a cookie in the browser after the page is loaded for first time, then from serverside remove the script when cookie is present. :)

      Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


      My Latest Articles-->** Microsoft Bing MAP using Javascript
      CLR objects in SQL Server 2005
      Uncommon C# Keywords
      /xml>

      1 Reply Last reply
      0
      • Y yrishi

        Hi, I have some code in javascript, which i dont want to execute on page refresh. How can i check that page is refresh using javascript Thanks in advance Yrishi

        A Offline
        A Offline
        April Fans
        wrote on last edited by
        #3

        Hi, Why do you want to know the page is refresh, or what do you want to do? If you just want to check the page is refresh, I suggest you creat a variable and change its value when the page is postback, and use js to check it.

        April Comm100 - Leading Live Chat Software Provider

        Y 1 Reply Last reply
        0
        • A April Fans

          Hi, Why do you want to know the page is refresh, or what do you want to do? If you just want to check the page is refresh, I suggest you creat a variable and change its value when the page is postback, and use js to check it.

          April Comm100 - Leading Live Chat Software Provider

          Y Offline
          Y Offline
          yrishi
          wrote on last edited by
          #4

          Thanks for your reply. Actually I am using window.open method in my application.It is working perfect if i close my browser.But if page will get refreshed or if i navigate in my application then also window.open is executing. Please help me on this

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups