In my asp.net application, page is refreshing specific time using Response.AddHeader("Refresh","30"), but if i open pop up(window.open) case also Page is refreshing then pop up closing. How to stop the refresh in parent page when Popup opens.
I tried with another code.Added below code in window,onload event.
setTimeout(function(){window.location.reload()},30000)
How to increase refresh time when we open popup(window.open).
Thanks.
The following code at the bottom of the page is what you need.
setTimeout(function(){window.location.reload()},30000)
Related
Is there any way to stop a web page from refreshing when it is displayed after someone presses the back button?
My web page shows different information every time it is refreshed. I want it to show whatever it was showing before the user moved to another page.
Is this possible? If so how?
No.
The contents of the window when the 'back' button is pressed is actually data your browser has cached so preventing 'back' is not going to help.
You could maybe use a hash though.
go to
stackoverflow.com
then go to
stackoverflow.com#foo
then go to
stackoverflow.com#foobar
If you hit the back button you'll notice the hash changes but the page does not refresh.
Sorry about the formatting. Blame SO!
In my chrome extension, I am using content script on a particular site. When a particular button is pressed, the page refreshes with new updates. Is there any way to show a Modal window or Popup, from the time the button is clicked till the page refreshes.
Modal window or popup: no
But you can use a chrome notification. It will show a customizable window which you can remember its id and take it down when the page refreshes. I do this for a popular extension i develop.
I have one icon (say open) in home page. When I click on this icon one child window will be open and the icon in that home page is also changed to 'close icon'. When close this popup window the icon should be same as previous icon (i.e. open icon) in home page. It's working fine when I stay on the same page.
But when redirecting from home page to next page the entire page gets reloaded. And the default image (open icon) is displaying even if the popup window is opened.
Now my requirement is:
At the time of page redirection the image should be loaded based upon the popup window. i.e. if popup window is open it should display the close icon otherwise it display open icon.
If page is refreshed or redirecting to another page the reference of the popup window is removed. then how can I get the reference of that popup window in a redirecting page.
How to count the number of child windows for a browser
EDIT:
I have tried the following solutions:
I set cookie at the time of opening a popup window and reset that cookie whenever I have closed that popup window. But the problem is, at the time of page redirection if I close the popup window the cookie is not reset to it's previous value, because the page is still in processing.
same problem with the session variable also
Please help me.
Set a cookie or a session variable when you open and close. This way you can remember the state of your popup window during new requests
When you go from one page to the next, you lose the reference to the pop-up window. But the pop-up window doesn't lose its reference to the main window. window.opener will always point to the window that opened it, even when there's a page change. Use this fact to reestablish communication between the windows after a navigation event. You might need to use an interval function to probe the main window, as I don't think you can listen for an event.
i have a aspx page which i am loading using facebox. In the form i have a button which submits the form.on clicking the button the facebox closes and browser shows the same form which was opened in facebok.
I used asp.net update panel to avoid full postback in popup, but using update panel not showing the facebox popup.
how can i make the facebox popup windows stayed there as it was before postback.
How is the facebox code being bound to the button? Now that the button is wrapped in an update panel, you may have to wait until after the update panel loads to bind.
You can put your js code in this event, and it will run each time an update panel ajax call finishes.
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(bindButton())
How would I prevent the browser from opening the pop up window that was displayed from the previous page when the user clicks the back button?
I hope that made sense but I'll explain it in point form below:
There are three pages: Page1, Page2, Page3
User loads Page1 and clicks a link to load Page2 in a new window using JavaScript (i.e. window.open(...)). The User can close Page2 anytime they wish-- but we'll assume the user does so before step 2.
User now clicks a link on Page1 to load Page3.
User is now on Page3 and clicks the back button on their browser.
Page1 is displayed in the browser but Page2 is displayed again in a pop up window.
So, I'm wondering if there is a way to prevent Page2 from popping up again. I am using classic ASP as well, if it matters.
If Page2 is opened as a result of clicking a link, how is it automatically being opened when the back button is clicked? Unless Page2 is opened automatically on the initial load of Page1, it shouldn't pop up due to the back button being pressed - pressing "Back" doesn't click a link on the previous page. I suspect something else is going on in your page - can we see some code please?
you can try creating a session variable on page2. and check if it exist upon opening of page1. or use a cookie.
EDIT:
Function IsPostBack()
IsPostBack = (Request.ServerVariables("REQUEST_METHOD") = "POST")
End Function
this will not detect a page refresh though..
The page was redirecting to itself and inserting the javascript code to pop up a new window based on the button pressed previously. I think it determined this via the post or get methods. I forget now.
As such, when the user presses the back button, they will reload the page with the embedded javascript code and not the original page.
We've since left classic ASP behind so I can't really test any suggestions but appreciate the help.