Using history.back() in UIWebView but loaded pre page contains very old data - ios

IOS 8.0+
My app use UIWebview to visit a forum site.
The forum front page contains two tag: default one is 'Recommend', another one is 'Newest'. Using ajax to load post data When user switch to 'Newest' tag, at the same time the page runs the follow codes to save state:
window.history.pushState(null, title, url);
After that if user is interesting with some post, he/she would click link and jump to a new page to view detail of the post. In this page, I use follow code to let user have a way to go back to 'Newest':
history.back(-1);
Now interesting thing happened, go back to 'Newest' tag but post data is old.
After some tests, I found the data is always be the first time loaded after installed the app. This bug will not happen in Safari or Android app.
I believe it should have some relationship with webView cache.But why UIWebview does't use new cache? And how to
solve this problem?

Oh no...nobody meet this problem?
My current solution is:
use js code to auto refresh the page when go back.

Related

How does loading all pages with ajax affect the back button?

I'm a newby working on my first site. I'm using a music player that I would like to have play continuously throughout the site, so I'm researching the consequences of loading the site's various account pages with AJAX (ala Soundcloud or Spotify). I'm curious to know how this will affect the back button.
If the site is completely AJAX, when the user hits the back button to go back to (apparently) a previous account page, the site will be lost to the previous site in the browser's history. However, if Soundcloud's pages are loaded via AJAX, they've modified the back button to accommodate switching to the previously loaded AJAX page.
well, after 5 seconds of google I found HTML5 history.pushState
EDIT. Ended up going with rack_pjak

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.

How to update iframe page tab content using a form?

I am trying to pass data using a form to a Facebook iFrame page tab but can't seem to figure how to do it.
I have a page tab on my Facebook page with several elements such as links and images directing users to various pages on the main website. This is updated every week, so rather than update the HTML file and upload via FTP everyweek i would like to see if i can create a form to pass the new data to the iframe.
In addition the Facebook page tab cannot be created in PHP as the server is running ASP.NET
I am trying to do this without the use of a database table if possible, using POST or GET would be preferable.
If anyone knows of any tutorials or has any tips i would be very grateful.
Cheers
You can only pass content or interact with iframe content if it's on the same domain as the parent webpage that has the iframe. All browsers have a "same origin policy" that prevent you from being able to do that - sorry :(

How can i do like the Pinterest unique modal process?

I have a question that
Point> I don't want to know generally function of modal, but like Pinterest
Question core > 1. Can i change the URL when i use ajax without "reloading"
Work flow >
1) On Pinterest, i click on a image
2) A modal window opens up, but the URL of the page also changes without "reloading"
even though it use ajax
I've known that when i using a modal function, it dosen't change the URL on the page,
but not on Pinterest
URL change e.x) rootURL -> otherURL
3) I click the background of the modal, the URL of the page also changes without "reloading"
and modal windows closed
URL change e.x) otherURL -> rootURL
So, If you have some solution or information, please let me know that.
Also I have red related question answers, but it's not enough. and don't want to get information obout HTML5 API cause i'm not going to provide HTML5 service
How can I duplicate Pinterest website's modal effect?
Pinterest like ajax loading
Changing the Url without a HTML call
Manage in the same url the Full HTML document and a JSON object (or a partial HTML response)
you can do like this http://mazzimo-in-london-eng.blogspot.com/2013/01/the-pinterest-url-sorcery-how-pinterest.html

Resources