page-refresh

How detect “refresh” event with prototype?

独自空忆成欢 提交于 2019-12-12 23:40:13
问题 How detect "refresh" event with prototype? A Cross-browser solution? Thanks, Celso 回答1: There's no way to detect refreshes in particular, but you can catch the browser before the page gets unloaded (which happens when the user refreshes the page - as well as when they 'move' to another page) In prototype this would look something like this: Event.observe(window, 'beforeunload', yourFunction); If you need to tell the difference, you could always bind some code to the links on your page that

Firefox addon which refreshes the tap and auto resend data

不羁的心 提交于 2019-12-12 18:43:02
问题 I'm trying make a firefox add-on, which reloads a page automatically under some conditions. First I add a contentScript to a tab to get some information on the page in my addon tab.attach({ contentScript:self.port.emit... I have it working to the point of the refresh with tab.reload(); but then an alert pops up every time "if it should resend data". I want to resend the data automatically. How and where do I do it? In the add-on or in the contentScript? Has it to do with the Load Flags

Page refresh from address bar with #hash

孤者浪人 提交于 2019-12-12 13:07:40
问题 Situation: url: http://mydomain.com/test.html#somehash test script: $(document).ready(function () { console.log("page initiated"); if (window.location.hash) { console.log("hash changed (if-statement)"); } $(window).on("hashchange", function () { console.log("hash changed (on statement)"); }); }); The script can also be found on fiddle, but the environment is not suitable to display the behavior. The problem I get is when I click on the browser addressbar and hit enter without any changes.

Stop Javascript and HTML from Loading From Cache

梦想的初衷 提交于 2019-12-12 09:38:29
问题 I am building a single page javascript app and when the application starts I use a single javascript file to load every other file I need on the fly. When I hit refresh, according to firebug, my HTML page as well as javascript pages will load with a 304 Not Modified Error and my javascript stops working. I understand this is due to browser caching, but how can I avoid this? I load the initial HTML page with a single script call <script src="js/config.js" type="text/javascript"></script> and

browser refresh does not do garbage collection

爱⌒轻易说出口 提交于 2019-12-12 07:49:05
问题 I have found this on all browsers tested - IE, Firefox, Chrome and Safari on Window sand Safari on Apple. Allegedly, a browser refresh, back button or forward link should dump the browser nodes and javascript variables and objects, etc. This appears to not be the case for WebGL. I first noticed it when developing a complex WebGL application that requires about 100MB to 200MB of memory. While developing, I have to do a lot of refreshes and my computer would start to slow down and freeze after

Meteor template data context not available in template.created upon refresh

大城市里の小女人 提交于 2019-12-12 04:37:01
问题 I use the template data context inside a template's created function. Template.temp.created = function() { console.log('this.data'); }; When I go to the page normally--i.e. click the link to the page--I see the console log the correct data object. When I hit the refresh button on the page, this.data is null . Why? Also, I am using iron-router to set the data context: ... this.route('temp', { ... data: function() { return MyCollection.findOne(someId); }, ... } ... 回答1: If you want to wait

Form get's resent on refresh

。_饼干妹妹 提交于 2019-12-12 03:12:48
问题 Form get's resent on refresh, I had read about header("Location:my_page.php") unset($_POST) , but I'm not sure where to place it. This is our script, it works as need it, but it keeps re-sending on page refresh (Chrome browser alerts over and over), can some one fix the code and explain to my like 2 years old child. <form action='thi_very_same_page.php' method='post'> Search for Christian Movies <input type='text' name='query' id='text' /> <input type='submit' name='submit' id='search' value=

How do I load a specific url on refresh?

ぃ、小莉子 提交于 2019-12-12 02:56:28
问题 Let's say that someone decides to press F5 or the browser's reload button. Is that possible to open a specific url in the same tab? 回答1: Like posted in comment, if you display prompt, this is possible using following ugly hack: var a,b; window.onbeforeunload = function (e) { if (b) return; a = setTimeout(function () { b = true; window.location.href = "//test.com"; }, 500); return "Now you will be redirected to new page if choosing to stay there..."; } window.onunload = function () {

Redirecting to a specific action on browser back button click MVC

人走茶凉 提交于 2019-12-11 14:32:59
问题 How can I redirect to a controller action when the browser's back button is clicked. I can achieve this by clicking my own button or link on the page hustle-free but getting the same result from clicking the browser's back or refresh button is an issue. I have a controller called "Notifications" An action in the contoller called "Unlock" whick takes "id" as an argument. My Link works perfectly fine: @Html.ActionLink("Back to List", "Unlock", new { id = Model.NotificationId }) I've tried using

asp.net stop button event running on Refresh

百般思念 提交于 2019-12-11 11:50:48
问题 I have a button that has click event in my C#. This works great. However afetr pressing F5 to refresh the page I noticed the button event is fired. This occurs every time I click F5. I've added if(page.IsPostBack) and the method still runs. Is there any way to stop this method from firing when the F5 Refresh button is clicked? Thanks! http://pastebin.com/9ycNraaT 回答1: If you have a page that needs to be run once, you should implement logic in your code that prevents the same method from