How to prevent double-refresh on frameset - javascript

I have a situation where pressing F5 or CTRL+R causes a frameset to load a frame twice. It happens on localhost, but as I've just put together an example for this question and uploaded it, I notice it varies by browser.
Visiting the link for the first time or clicking the browser address bar and hitting enter performs a 'normal refresh', as desired.
The test case I put together below has 2 frames, one left empty. When frame1.html loads, the frameset then sets frame2's src, which then loads frame2.html. Both should alert only once, but you'll see that is not the case for 'frame2.html'.
Behaviour-by-browser:
Chrome16 & Safari5.1 works as expected both localhost/live
FF9 double-up on localhost, works as expected live
IE9 double-up on both localhost/live
haven't tested other / older browsers yet, but I anticipate some agony
I tried clearing the src attribute on the frameset's unload event in the hope it might at least load nothing before doing the double-up and then loading frame2.html, but even if that had worked (which it didn't) it's nasty.
My questions:
Why is the double refresh happening, when it does happen?
Is there a way to prevent the double-up?
Here's the link: http://codefinger.co.nz/public/frameset_test/frameset.html and also the rar'd files: http://codefinger.co.nz/public/frameset_test/frameset_test.rar

Ok, lack of an explanation drove me mad, but I did find a way to stop this default, inconsistent behaviour.
I listen to the frameset's window.unload event (YUI3.5), and remove the double-up frame node altogether. The double-up goes away, everything appears normal.
Tested successfully in (both localhost and live server):
Chrome 16.0.912
Firefox 3.6, 9.0.1
IE 6,7,8 & 9
Safari 5.1
Does not work in:
Opera 11.61 (I can't access and manipulate the frameset element)
I'll still +1 for any explanations as to why the frameset load double-up occurs in the first place.

Related

Why does Firefox lag using NVDA on a page setting textContent?

Recently I've been testing my website using screen readers and ran into a page that lags like crazy when using NVDA. More specifically:
All browser actions are substantially delayed, but NVDA itself runs perfectly fine
For example, the page normally loads in its entirety in less than a second, but with NVDA active, the first image can take several minutes to render
Refreshing the page takes several minutes to execute
Even switching or closing the tab takes several seconds
After some extensive debugging, I isolated the issue into a rather specific set of criteria causing the slowdown:
This only happens on Firefox (I'm currently on Firefox 90); Chrome and Edge are fine
This only happens with NVDA; VoiceOver on Mac is fine even on Firefox. I do not have JAWS.
The action causing a slow down is setting an element's textContent on every requestAnimationFrame, so it's happening dozens of times per second
I am uncertain if this is experimentally significant, but I'm running on Windows 10 Home
I managed to scrape together a minimal CodePen example. I used CodePen here because the simplest way I could replicate the issue was by refreshing the page. In the example is a refresh button that activates a spinner, so if the page is fast the spinner will show up for only a brief moment; if it's slow then you'll get to observe the spinner in all its glory.
What I see when I try to refresh:
So while I isolated what is causing the issue, I have no idea why this is happening and hence how to solve my original page's problem without deactivating the widget outright.
What might be the underlying cause(s) of Firefox/NVDA slowing down on a page setting textContent?
Is there an alternative to setting textContent that I can or perhaps should consider?
Is this perhaps an issue that should be filed directly with either Firefox, NVDA, or both?
Thank you!
Addendum:
NVDA Github Issue: This open issue indicates long pages are slow to load, which may be related to my problem
My Website's Page: The page on my website I'm talking about

Debugging for MS Edge constant reload - how to trigger debugger?

I am debugging some code on the MS Edge browser, but it reloaded twice and showed a "This page is having a problem loading" message after two tries. The page has been tested on IE11 or lower, Chrome, and Firefox with no issues.
I have been having trouble bringing up the debugger during page execution by placing the debugger statement in various parts of the code. I have placed it in the first line of the script in the body tag, I have placed it in the first line of $(document).ready(); and even in the script tag in the header. I am so surprised when none of the debuggers triggered other than the one in IE11 (both Chrome and Firefox did not trigger either). Edge of course still continued on its reload loop and saying that it has a problem loading.
My question is - am I not doing this right? Is there a list of when a debugger; statement will not trigger? And more importantly, how do I trigger it in Edge before it reloads twice and throw the error page (For reference, pulling up F12 after it throws the error page gives the DOM of the error page, which is not helpful.)
This is an issue with Edge where the console seems to crash along with the browser. I have noticed it numerous times during development and have not been able to find a solution.
Check in every other browser on an empty cache and see if you are getting any errors in console. Older versions of Edge, before the last service pack were very flakey so I would suggest making sure your environment is upto date.

IE iFrame loading icon

Good day,
I have a problem with IE and iframes.
So I have a huge application with legacy code, designed in early 2000. iFrames are used everywhere.
When something big is loaded inside the iframe, there is no display in browser throbber. So the loading icon starts spinning only when the main page is loaded, not iframes, so its impossible to say if anything is happening at all.
The users complain, that IE10+ gives them this problem, earlier versions worked. For me IE9 also has this issue.
Unfortunately, it is impossible to use JS on every page and manually add the 'loading please wait' icon or message, there are more than 100 pages with more then one iframe on each.
Chrome works fine, but nothing except IE can be used.
Could you please recommend solution for this trouble?

Javascript file loading twice

I am having a strange problem in Google Chrome. I am including a js file via script src tag. I place alert('test') in the file and when I load the page in Chrome, It alerts twice. In every other browser it alerts once. Is there any known cause for this?
Here is the code that loads the JS:
<script type="text/javascript" src="/js/main.js"></script>
It appears this happens in Safari as well. Does not occur in IE and firefox.
I had this recently and eventually found out it was a chrome extension, specifically the cache killer extension
This might be helpful
Webkit browsers (Chrome, Safari) are loading pages redirected from .htaccess twice!
I've noticed this same problem in Chrome. I have some code that runs when the page loads and I have an alert inside that code. In every browser other than Chrome this code is run once, thus the alert displays once. In chrome the alert shows twice. I am not doing anything special, just running code when the onload event is triggered within <body onload="somefunction()">. I am not using links, iframes, or the Cache Killer extension. I tested it in Safari and the code is only being called once. This seems to be a Chrome specific problem.
I did some research and it appears this is a bug with Chrome. I found this link https://code.google.com/p/chromium/issues/detail?id=64810
Depending on your specific situation, this page may give you a work around for the problem.
The problem does not seem to be fixed as of yet.

ie7 doesn't recognize a page with different anchors (hashtags) as 2 different pages (hence history doesn't work)

As part of developing some ajax history behavior I encountered a weird thing: (my) ie7 doesn't recognize a page with different anchors (hashtags) as 2 different pages.
The consequence is that when using the back-button ie7 skips over all previous urls (which only differ by the hashtag).
for example lets say I have browsed the following items in this order:
www.google.com
www.mysite.com/index#ajax1
www.mysite.com/index#ajax2
www.mysite.com/index#ajax3
hitting the backbutton while on www.mysite.com/index#ajax3 brings me back to www.google.com
I'm really breaking my head on this one. To check my sanity I tested some random pages with anchors, loaded the up and indeed the same problem.
As far as I know this is not expected behavior (all other browsers (chrome, ff, safari) tested work ok. Am I missing something really obvious here or is my install of ie7 just messed up?
This works on a local file in IE7. I haven't tested it online yet.
Link to Anchor 1
Link to Anchor 2
Link to Anchor 3

Categories