I am having a strange problem i.e., when I am opening my website a loader is loaded and then homepage displays. Now I am navigating from home page to different page, everything is fine . The problem arises when I am getting back to the home page the loader is again loading.
In normal situation it should not load. Not able to find out the reason. I am running the website locally so cant provide the url
window.onload() I have used.
The Window.onLoad() event ALWAYS triggers when the page finishes loading.
http://www.w3schools.com/jsref/event_onload.asp
What is the reason to think that going to your page won't trigger onLoad() the second time? The browser won't know the difference whether it is the first, second, or 500th time.
Related
I'm having a weird problem that I originally just dismissed as a development glitch, but now I'm more concerned because It happens every time I refresh the page.
The issue is when I navigate to another page (localhost:3000/otherpage), sometimes it wont render that page at all. The page will turn completely white and have no HTML elements on the page (according to the dev tools inspector). However If I'm on that page and refresh this will always happen. Theses pages are dynamically rendered pages that have logic written that tells them to load a skeleton page while fetching the data, or render an error page if there's a problem with the request. I'm stumped as to why this is happening and have not been able to find anyone else that has experienced this problem yet.
My question is:
Why does this happen? and how can I work around this?
I have a screen recording to better explain whats going on.
(link to unlisted video):
https://youtu.be/mJPp3P4ElsI
I am trying to debug some code which loads a script with jQuery like this
$.getScript('src/myscript.js', function(){ // start page });
The majority of the time, everything works fine. But some users report intermittent problems with the page not starting. Based on logs I have added to the code, it is clear that for some users, the load callback is never triggered again after they load the page a second time. Clearing their cache removes the problem, but every subsequent reload of the page...it stops again. Other users report intermittent problems, same log results. The user who always has the problem is using Chrome on a Mac.
Anyone had problems like this? I can't find anything in the docs or Googling which would suggest a possible reason..
I have a script in a separate js file, which for now, contains
$('#page-seriesLevel').live('pageinit', function(){
console.log(document.URL + ' loaded.');});
This is called from series.php ideally when the page is ready, and catalog.php links to series.php.
But when I go to that page from catalog.php, the script does not execute. I have to refresh to see it. Sometimes the script executes from catalog.php which it shouldn't.
I'm a little confused about what your asking. If the problem is that the page load event, 'pageinit', is not triggered every time you go to the page, try using 'pagebeforeshow' or 'pageshow'. 'pageinit' is only triggered the first time you go to the page.
See the "page load events" section on http://jquerymobile.com/demos/1.2.0/docs/api/events.html for more information.
I knew that JQM loads pages via ajax, but I didn't know that it just loads the element with data-role="page", ignoring the head (where my JS was), as this answer says. https://stackoverflow.com/a/7449731/677331
Im playing around with making my first chrome extension. Im making a small extension that monitors the webrequests a page makes. This means that im listening to the: chrome.webRequest.onBeforeRequest.addListener event
I am a little confused on how to execute this code on every page i load. It works on any page if i open the extension web page and run the code in this context. However i would like it to run regardless of having the page open. How do i go around doing this?
I looked at content_scripts, but havent figured out if they are the proper path to take - and ven if they are how do i send a message from my content script to my web page notifying it to run the code. As far as i understand this the content script is first run after the page has been loaded and therefore it does not matter if i call my page and add the listeners, because the show is already over - is this correct?
The wa i understand this is that i cannot add listeners in the content script - hence the need to make this messaging thing - is this correct?
Thank you.
You would put the onBeforeRequest listener in a background page, specifically the persistent variant of it. When the event is invoked, whatever you have in the handler will be run.
Sometimes when I open a page, it has blank only, but when I refresh the page or the browser, the page can be rendered.
I want to know why it happened and how the problem happened so much!
Some code from your HTML could be helpful but this is what I'm thinking:
It may have something to do with the order in which you are including your JS files. Be sure to load ext-base.js then ext-all.js before your own javascripts. You will then need to load any other resources required for your layout to render.
I'm thinking that on the first (blank) load, it fails to load the screen because of the resources are not coming in at the right time. When you reload the page, the scripts load because they have already been cached by the browser.