I have set a search page and it's working properly, But when i click on back in browser then the problem(mention below) appears, So how can i can i disable this.
Confirm Form Resubmission
This webpage requires data that you entered earlier in order to be properly displayed. You can send this data again, but by doing so you will repeat any action this page previously performed. Press Reload to resend that data and display this page.
After processing POST on your page
example.com/mypage.php
use
header('Location: example.com/mypage.php');
In this way the post will not be resubmitted and you wont get the alert from browser.
Use the command line option -disable-prompt-on-repost for Chrome.
Related
I am developing an ionic app which allow every user to see all his places and the places he's invited to, provided he clicks on the "My Places" tab. The problem is whenever I open the tab I have to refresh the data by calling API. What I tried to do is to trigger the scope responsible for fetching the data every time he add a place, delete a place, or he's invited to a place. For example, if he add a place, I emit this $rootScope.$emit("RefreshPlaces", {}); and in "My Places" controller I have
$rootScope.$on('RefreshPlaces', function() {
$scope.getPlaces();
});
The problem I encountered is that "My places" controller sometimes isn't loaded and thus don't receive the event and we see nothing on "My places" tab ( empty page ).
The reason I did all that is because the app become slow and it makes no sense to fetch data every time a user click on the tab.
Furthermore, I noticed while using Facebook and Quora that the naviguation between tabs don't always fetch data from server.How does Quora or Facebook knows when to fetch data and when not ?
I have an ionic app that has a search template that has a form where you can query posts by keyword. I also have a service that returns the post(s) as a list on another view. All that is working well.
My search controller upon submitting the search form uses:
$state.go('app.search.results', {'searchId': hash});
so that I can have a unique url for that search. I needed this unique url to implement 'back' functionality so that if a user clicks on one of the posts in the list, after viewing the post if they decide to click back, they would get to see the results of the search still (by default they would be returned to the search form without any results anymore).
To allow for a back to search results I implemented a custom back button function and put it on the ionic back button element like this:
<ion-nav-back-button ng-click="goBack()">
and then setup a the custom function:
$scope.goBack = function() {
$window.history.back();
}
All of this works well, I can go back to search results and see them, essentially very much like normal browser back functionality.
Problem for me is that when I have gone all the way 'back' via the back button, my initial state contains the 'Back' button and clicking it does not go anywhere and the 'Back' button still shows. Ionic does pretty good about hiding the back button when it shouldn't be there but in this case not so. Any ideas for how to check when history is exhausted and hiding the back button conditionally would be appreciated.
EDIT:
Here is a jsFiddle ; Note: open fiddle in a new, separate tab to see back button issue. FYI Search is in the menu.
One of the few qualms I have with Ionic is their "smart" navigation. I have run into a lot of problems with this myself. My solution was to create a back button of my own, this back button stores previous states and their params so you can go back and not lose search results for example with your scenario.
This component gives you both a back button and breadcrumbs to use (or you can just use back button)
It is open source and feel free to use it!
jscBreadcrumbs
Strange Milk - Breadcrumbs Post
Here is your jsFiddle with the jscBreadcrumbs implemented and working:
jsFiddle
jscbreadcrumbs
You use $window.history.back(), I think you should use $ionicHistory.goBack(); instead. It can control the history and view and state in the ionic way.
I am writing something like a registration process containing several steps, and I want to make it a single-page like system so after some studying Backbone.js is my choice.
Every time the user completes the current step they will click on a NEXT button I create and I use the router.navigate method to update the url, as well as loading the content of the next page and doing some fancy transition with javascript.
Result is, URL is updated which the page is not refreshed, giving a smooth user experience. However, when the user clicks on the back button of the browser, the URL gets updated to that of a previous step, but the content stays the same. My question is through what way I can capture such an event and currently load the content of the previous step and present that to the user? Or even better, can I rely on browser cache to load that previously loaded page?
EDIT: in particular, I'm trying something like mentioned in this article.
You should not use route.navigate but let the router decide which form to display based on the current route.
exemple :
a link in your current form of the registration process :
<a href="#form/2" ...
in the router definition :
routes:{
"form/:formNumber" : "gotoForm"
},
gotoForm:function(formNumber){
// the code to display the correct form for the current url based on formNumber
}
and then use Backbone.history.start() to bootstrap routing
I'm creating a Google-like application in Visualforce where the user enters a search term, clicks Search, and the results are displayed underneath the search box. As part of this, when the user clicks Search, an actionStatus is set up to display "Loading..." while the search is in progress:
<apex:commandButton value="Search" action="{!runQuery}" status="loading"/>
Now I'm trying to set up the landing page, which is just a page with an input field and a Search button, for the initial search. In Google style, the first search will take the user to the page where results are displayed with the search box moved up to the top.
The problem is that I don't know how to invoke the actionStatus at page load. It's easy enough when the user clicks a button, but when searching from the landing page, a new page is loaded and then the search is carried out. At the moment I just have the controller's constructor checking for parameters and, if any are found, calling runQuery() manually, but this simply delays the page load time and doesn't invoke the actionStatus.
Any ideas?
Use
<apex:actionFunction name="runQueryJS" action="{!runQuery}" status="loading" />
to create a client-side invocation point, then attach a handler on body's loaded event (or wherever else you want to run query from) which will call the runQueryJS() javascript function which will do an Ajax call to search.
Adding an onLoad event call didn't work, but putting this at the very end of the page, just before the closing apex:page tag, appears to. I'm not entirely sure why, but it's clean and gets the job done.
<script>
runQuery();
</script>
I have a CakePHP app that seems to be terminating my session on one specific action. I have a page which, when a link is clicked, launches a Fancybox overlay of the iframe type. In that overlay, the user fills out and submits a form. The form is submitted properly, does its work (including sending an email), loads the success view and lets me close the overlay, but as soon as I try to get to any other page, I'm sent to the login screen to reauthenticate.
The value of my Security.level config setting is medium and my Session.timeout is 120, so that shouldn't be the problem. Anyone have any idea what could be creating this?
Thanks.
is it possible that your ajax calls and redirects are not going to the same place, eg www.site.com and site.com? I have had that before and also kept getting logged out.
So this wasn't fun to track down, but it was me being an idiot. Buried in the code was some early-stage code to refresh user data in the authenticated session that wasn't doing what it should have been doing. It was attempting to update the entire Auth.User object directly (e.g. $this->Session->write( 'Auth', $user )) instead of calling the login method.
Once I changed the Session::write() code to $this->Auth->login( $user ), everything lined up nicely. A nice bit of reference material on this subject at http://milesj.me/blog/read/31/Refreshing-The-Auths-Session.