I made a simple refresh button that used to work, and when I say 'refresh' i mean refresh to the current page (clearing data) and not a 'backspace' button that goes to the previous page.
onClick="window.location.reload()"
history.go(0)
window.location.href=window.location.href
I usually use one of these to refresh my search function to clear the data for a new search, just by refreshing the page, but all of a sudden I am getting a previous page instead. I am not sure why. I was testing on chrome. The problem is the way it is now the previous page could be anything, including something offmy site like google search ect.
Has anyone any idea what i am doing wrong?
I also tried
window.location.reload(true)
and
window.location.reload(false)
but I seem to be going around in circles.
<button onclick="window.location.reload(true);">Click me</button>
The "window.location.reload();" is javascript, to check if an error is occuring when you run this page press f12 to view your browser tools and move to the console then attempt to reload your page, any javascript error will appear there.
Related
I currently am building a website that fetchs data from MySQL with php and then displays it. On one of the pages I use a form to submit data and then I reload the page to display it. It does it's job fine and works exactly as I want the only problem is when a user presses the browser back button it goes through all previously submitted data instead of just going back to the page it came from. Is there a way to reload a page without the browser storing it or is there a way to make the browser go back to the previous page instead of history.
NOTE: I am aware of Ajax and how to use it to not reload the page at all but I wanted to see if there was a way to do it without redesigning my whole page with a seemingly small problem.
You can use history.replaceState in HTML5.
Another possibility appears to be
window.onpopstate = function(event) {
window.history.go(-1);
};
although I have not tried this myself.
See https://developer.mozilla.org/en-US/docs/Web/API/History_API and https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onpopstate
Im working on a website, and I've currently ran into a problem thats got me mind boggled.
It happens on more than one page, but when I refresh the page, the navbar, search bar, and other things mess up all over the place.
When I click on a new link or refresh (sometimes) its back to normal. Then I refresh again the page looks messed up again.
my page is www.ram-bay.com if you want to have a look.
Sometimes when you refresh its okay. refresh a few times on any page it seems to mess up.
Can anyone seem to spot the problem?
Also before you ask me to link code... there is a lot of it
Your page is looking just fine in Chrome/Safari. What browser are you using?
I see that you're using bootstrap and jQuery over CDN, so maybe you have issues with your network connection. Try to get all file stored on your server and see if it fix the problem.
I am finding that when I use the back button on the browser or window.history.back(); the page being loaded sometimes refreshes and sometimes doesn't. I have not been able to reproduce this reliably but it is causing a problem in that I do not want the page being gone back to refresh is it displays different information every time it is refreshed.
I either need to ensure the back button and window.history.back(); do not cause a refresh, or I need to be able to detect on the page that it is being redisplayed as the result of a back button so I can somehow stop it being refreshed.
Is anyone able to explain why it sometimes refreshes and sometimes doesn't and what if anything I can do about it?
check out the html5 history api
https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history
I never implemented it by myself, because angular is managing the history by itself, but I think it should solve your problem
I have to do some customization work on OpenERP Mobile Client. The Problem is that it works on #tag Url's like
http://localhost:8069/web_mobile/static/src/web_mobile.html#oe_menu or
http://localhost:8069/web_mobile/static/src/web_mobile.html#oe_sec_menu_21
Problem is that one I am on any page and for any reason if i Refresh the contents never Loads again. it just gives me a blank page. If I copy the URL and Paste in a different Browser window then also nothing. I cant Find out whats the Problem In the Code or how it works. The Documentation of Mobile Client is too Poor.
I am banging my head here from last one week I need Help.
Yes, There is no specific mobile console for R&D purpose. So its core issue from mobile client.But other alternative is use Back button click event for navigate the page which is shown on top of page instead of browser back button.
You can used Home button as well as Back button for refreshing purpose.
I am making a greasemonkey script and i would like a link to go forward and modify the current html and allow the user to click back to go to the original page.
How might i do this? using jquery + greasemonkey + javascript. Targeting firefox mostly.
-edit- http://jsfiddle.net/ seems to do it. If you write random html in the html section, hit run, change the html and hit run again. You'll be able to click back/forward to see the output change (however the html input box stays the same). I am using firefox to view this. Thats the effect i want.
it appears the magic is done on line 91. Is this submitting a form in a frame (perhaps the results frame?) and that is causing the movement in history?
88 run: function(e) {
89 e.stop();
90 Layout.updateFromMirror();
91 document.id(this.options.formId).submit();
92 this.fireEvent('run');
93 },
I don't know if that is possible at all because it is the browser itself that takes care of the navigation history. A new history item is added only when you visit a new page.
If I am not wrong you would like the user to turn on/off the changes you make to the page without enabling/disabling greasemonkey and reloading the page.
The only solution I see for this is to take care of it yourself. Save any changes you make to the page so that you can restore it and add some UI to the page to make the user turn on or off your changes.
EDIT 1:
It seems that jsfiddle.net loads a new page to do that. Using firebug you can see it is not doing any AJAX request to run the code, it is just loading a new page (maybe the same page, with different parameters, but nevertheless it is loading a page.)
EDIT 2:
Yes, maybe it is loading the page in a frame. As you can see from the HTML:
<iframe name='result' frameBorder='0'></iframe>
But this does not change your situation. If you want your logic to be in your greasemonkey script you can't load a new page. Otherwise you should upload a web page somewhere and make it load in an iframe passing it the HTML you want to modify: this is definitely not what you want to do.
It sounds like you want to use a history manager. You could either track the changes you make and undo them when the user goes back, or possibly call a page refreshing function.