Stop HTML/JavaScript Page From Loading Mid Initialization
Dec 21, 2010
So imagine a piece of Javascript as the first script on a page along the lines of
var MySuperObject = new (function () {
this.SuperObjectInit();
})();
Now imagine that everything that proceeds this script (or a large portion therein) requires the SuperObject to have met its load conditions and loaded correctly.
Assuming for whatever reason the loading of the object fails I need to abort loading the rest of the page and the scripts in particular.
I know the majority of you are going to scream why not have your function issue a callback onSuccess and onFailed but the problem is this is in a ASP.Net project with masterpages, nestedmasterpages, usercontrols and so forth (each of which have their own dependencies and scripts); rendering such an approach problematic.
The other option (I assume) is to use window.location = "myErrorPage.html"; but I dont like the idea of having to create another page for an error message or the fact that it causes a redirect.
What I am hoping to do is something along the lines of
StopLoadingPage();
document.write("Error has occurred");
I have an ASP.NET (C#) page that has a long load time (like 2 minutes). The user is presented with a little animation and a "please wait" message. If the user accidentally loads this page, they need to wait for it to load.
My question is: Is there a way to stop the page load?
The above throws this error: CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments
i have an html page and i want to open it in an .aspx.
I need to made some changes in html before i show that in browser , and i need to make them in memory, so i open and load and make changes to my html Page and , now i need to pass that html string to iframe, but i am not able to do dat from code behind, iframe.innerHtml do not work.
I tried to set innerhtml for a div instead of iframe, that works , but here when browser renders html page, it applies my Html page style sheat on my aspx ( where CSS are defined for body ). Means the CSS for body that is in head of my htmlPage , sets on my aspx page.
I have different projects and libraries for which I've created helpfile with Sandcastle. Now Sandcastle provides also the possibility to create a website.
What I would like to do is to create an aspx-page where I can dynamically create a menu and where the existing helpfile-websites can be sollicited. All in one place.
Is it possible to accomplish this? Maybe some control that I can use to view an entire webpage?
I already know this solution. (transfer the slow loading page to a loading-interim-page which shows the animation and then redirects to the actual page)But I would really like to solve this without a redirecting page.
I have an image control that puts user's photo in it. Once it's loaded, I resize it using the javascript.But the thing is, when the page is loading, the image gets really big, then shrinks down being called by the javascript. Is there a way for me to pre-load the image before displaying it? I do'nt want to set the image control's width and height to fixed pixels at this point.
I have seen few website where their home page is too big and when user scroll down to read the content the of the page then few area of that page load dynamically. how they design their page. as example the site is http://blog.rainbird.me/ where you can see the effect. please give me idea to achieve it via jquery & ajax.
I have a website with a menu, when menu item is clicked I display the page for that menu in an iframe(iframe is set to display home page initially by default). sometimes it could take few seconds to display the page for the selected menu item (for example reports) and I would like to display a loading image while the page is loading. how to do this using javascript or jQuery
Im currently trying to use a jQuery plugin:jQuery Autocomplete TokenizerNow after posting back the page, I want to re-load the values back into the textbox for whatever items had been entered.Now the jQuery on the page is like below:
$(document).ready(function () { $("#<%=txtPeople.ClientID %>").tokenInput("Handler.ashx", { hintText: "Type in a name", noResultsText: "No results", searchingText: "Searching...", [code]...
Old hand at ASP.NET, new to the UpdatePanel. I have a reporting page which executes a fairly length SQL query... takes about 10 seconds right now. What I would like to do is have my page fully render, with some placeholder text (Loading...) and then have the UpdatePanel kick off the actual time-consuming reporting process and render the report when it's done.
So... my theory is to use RegisterStartupScript() to kick this off and drop the string from GetPostBackEventReference() to trigger the UpdatePanel update. Some problems crop up:
1) Can I actually use GetPostBackEventReference w/ the UpdatePanel or do I need to trigger it some other way? Use this method on a button inside the Update Panel?
2) What event gets triggered when the postback reference is the UpdatePanel? It's not clear to me. I've got to call my databinding code somewhere! Again, maybe I need to use a button inside?
We have a silverlight/asp.net application which communicates with WCF to fetch data. Now we are facing a problem where in the silverlight component is taking some time to initialize after the asp.net page life cycle is completed.We have tried tracing all the events and found that there is a time lapse between the aspx page unload event and silverlight initialize event. This we have tried with even a simple application (hello world) but still have found the same result.There is nearly 3-4 seconds delay i.e the silverlight component initialization starts 3-4 seconds after the page unload event ends.
We have installed a web site written by others which is compiled with Visual Studio 2008 and hosted in Windows server 2008 R2.
The IIS connection timeout is set to 120 seconds. But for some pages, the first page loading fails with HTTP 404 error but sequential refresh can bring the page up. The same problem happens for some images which fail to load in web pages. We are not very sure it is network related issue or hosting issue.
then what happens when the first user controls load then test.js will download in client and when second user control loads then test.js file will download again.
How do I check to see if the JavaScript file is already downloaded so it doesn't have to be downloaded again?
If I include the JavaScript file from the server side:
I'm working with an external team with our website and they recently added one of my scripts to the .NET MasterPage of the site... well it did finally get my script running but now... it loads Banners on 'every' page on the site.
How can I write an 'if' statement that basically says... if this is the home page... run this script... if not don't...?
I have a static HTML page complete with client-side scripts and css (both are included in the html). I was wondering if it would be possible to embed this HTML page into an ASPX page and have the ASPX page be able to respond to javascript events that are raised from within the static html document? Does asp.net provide a specific control for this or can I use a frame?
I have update panel on the page to avoid postback and placed a dropdownlist control within that update panel. DrodownList is filled with Category names and also it's autopostback set to True.
Now whenever dropdownlist index change's on select, untill page loads complete data it should show mesage as "Loading.... in center and middle of the page and background should become bit transparent". And when page load completely with data then that background and message should get disappear.
how to get page HTML at client side or through javascript in Asp.net Application. Means if I want to get the html of http://www.yahoo.com on client side through javascript or any other
I had thought that returning false would keep my asp.net OnClick even from firing, but it still does. I've confirmed that it is getting to the return false section of code using alerts. Is there anything I can do to stop it from firing using jQuery/javascript?