Navigating to another page , results in previous page rebuilding - dart

i have a http call to upload image to server , after navigating from this page to another page , results in another http call , thus uploading the same image multiple times and this process continues . I am navigating to another page using Navigator.push method , can anybody help me in figuring out the solution to this problem.I believe this is a known issue with flutter , while we should assume that rebuilding is as intended but it results in unnecessary http calls.
i have tried calling http request in initState , but did'nt worked.
i expect the image to be uploaded only once after navigating to next page , but the actual result is , multiple copies of that particular image is uploaded.

Related

Why is the web page being requested twice?

Notice in the picture that the top two records are identical except for the timings and the "Cause" on the first line is document whereas it's img on the second line. I've never seen this before where the entire page is requested twice and don't understand how "img" could be the cause for requesting the web page.
Can anyone give me an idea where to start looking for what may be causing this (I don't see anything about any images in my site that would seem to be related?)
I found it. There was an image that was dynamically loaded, and so the developer set the src as "#" which was causing it to request the web page again. I found in another answer the best way to resolve this issue is to instead set the src to "//:0". The double slash sets it to current protocol so you don't get insecure warning, and port 0 is an invalid port so it won't actually make a request.

UIWebView history location

I am using WebView and goBack is implemented with custom back button . When I navigate more than one request deep in the web view, when trying to hit back, I will flip-flop between the last request and current, instead of backing all the way back to the initial page (Home page).
My Questions
1) Where does web view history stored,
2) Am I able to see the url array list when i navigate more than one request,
3) May I know location of web view history stored in application sandbox.
Thanks.
Check it out sample: https://github.com/samvermette/SVWebViewController
It is a drop-in inline browser for your iOS app.
Hope, It will helpful to you, Sir
:)

Backbone and jQuery Mobile App resetting after browser back button

I am building an app using Backbone.js and jQuery Mobile. On some pages in my app I have external href links and I'm running into an issue.
When a user clicks and external href link, get taken to the external site and then hits the back button. My app does not load from the proper page where the user originally left the app from.
In fact my entire DOM is reset so it looks like my site gets a complete refresh and doesn't keep any of its former state.
I have been trying to search for a solution but this issue is kind of hard to word out. I hope it makes sense.
Does anyone have any suggestions?
UPDATE
Stupid error on my part.. I had a bad id set on the page and it didn't load the data I had saved in the session for it when a user returns to the page.. Changed the id and all is well. Thanks!
Link
Make you external links open up new tabs.
If you have used one html with multiple pages solution then there's an explanation for this.
rel="external" will cause a full page refresh so last page location will not be remebered. When you return to the last location it will trigger new refresh and the first page will be shown again.
This can be prevented with a multiple html page solution.

Why are Google search results in UIWebView not triggering webViewDidFinishLoad?

This is no doubt a more generic issue regarding web pages, but it is easily demonstrated with Google content.
When entering some search criteria on Google's home page the results are not triggering the webViewDidFinishLoad method. The same problem occurs when the coloured Google logo is replaced with some artwork linked to a feature page.
I suspect the page is not being fully loaded due to some javascript or ajax code, so is there a way of detecting this?
This is because Google are using AJAX to do this, the webViewDidFinishLoad delegate method is called when effectively a new resource is loaded into the webview - the equivalent to a page load in your browser, since Google are AJAXing this stuff, it isn't causing that method to get triggered.
There isn't any way to detect when parts of a page are loaded (javascripts, style sheets or ajax responses).
One thing you could be able to do is execute a line of javascript onto the web view that tells you the height of the page, by waiting until the height of the page changes you could know when a result has occurred, you will have to devise some other - more smart check of course when a search query is modified, but my idea would work for the initial google logo screen to the first results page.
Executing that JS every few seconds should be enough.
Hope that helps

Previewing an image after it has been submitted through AJAX (Rails solution)?

I'm trying to see what is the best way to implement a mechanism as in use here: https://sortfolio.com/signup . Essentially, one selects a picture to be uploaded. Picture uploads in the background and then it appears on the page with no refresh required.
So far I manage to do the POST of the image (I'm posting to an IFrame, using a jQuery plugin) and show the progress bat. I don't quite understand, when / how to pull the image back.
I'm using paperclip for processing.
Any thoughts ?
Thanks.
I did some time ago an example application for a similar problem. You can find it here. It renders the image on a modal window, but I'm quite sure you can find some ideas on how to solve your problem.
In your Rails controller, when responding to an AJAX request, send back the newly uploaded image URL, the entire image as a JSON object (w/ URL included), or the partial HTML to render the image.
For example, using the first method, use jQuery to set the src of the img.
Something like within the callback of the AJAX request:
$('#image').attr('src', /* url sent back from AJAX request */);

Resources