Yii Framework Forum: Clicking On Browser Back Button Shows "document Expired" - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Clicking On Browser Back Button Shows "document Expired" Rate Topic: -----

#1 User is offline   pinky 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 51
  • Joined: 27-July 12

Posted 09 November 2012 - 07:25 AM

I've a chtml button in a "result" page. When it is clicked, it will bring you to the respective "result details" page.

However, when I'm at the "result details" page and I click the web browser's back button to return to the "result" page, I'll get a "Document Expired. This Document is no longer available." error page from the web browser. When I refreshed the "Document Expired. This Document is no longer available" error page, I'll get back to the "result" page.

Why is this so?

Anyway, I don't have a form, I'm just using the button to link to the "result details" page.

Is there any way whereby I can click on the back button of the browser to return directly to the "result" page instead of showing the error and I have to manually refresh the page to get back to the "result" page?
0

#2 User is offline   Keith 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,594
  • Joined: 04-March 10
  • Location:UK

Posted 09 November 2012 - 07:55 AM

Have you tried this in different browsers?
0

#3 User is offline   compact_corpse 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 62
  • Joined: 24-May 11

Posted 09 November 2012 - 11:13 AM

This usually happens if there is some POST data on your 'results' page. What you can do is use session variables to allow this:

//your results controller
public funtion actionResults()
{
    if(isset($_POST['fancy_data']) || isset(Yii::app()->session['fancy_data']))
    {
        $data = isset($_POST['fancy_data']) ? $_POST['fancy_data'] : Yii::app()->session['fancy_data'];
        Yii::app()->session['fancy_data'] = $data;
  
        //do your thang, gurl...
    }
}


This is what I do, and unless there is some security flaw I'm missing, it should work fine.
0

#4 User is offline   pinky 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 51
  • Joined: 27-July 12

Posted 10 November 2012 - 11:11 PM

View PostKeith, on 09 November 2012 - 07:55 AM, said:

Have you tried this in different browsers?


I've tried in all the browsers but it still happens.

In IE, the error is:
Webpage has expired

In Firefox, the error is:
Document Expired. This document is no longer available.

In Chrome, the error is:
Confirm Form Resubmission
0

#5 User is offline   pinky 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 51
  • Joined: 27-July 12

Posted 10 November 2012 - 11:17 PM

View Postcompact_corpse, on 09 November 2012 - 11:13 AM, said:

This usually happens if there is some POST data on your 'results' page. What you can do is use session variables to allow this:

//your results controller
public funtion actionResults()
{
    if(isset($_POST['fancy_data']) || isset(Yii::app()->session['fancy_data']))
    {
        $data = isset($_POST['fancy_data']) ? $_POST['fancy_data'] : Yii::app()->session['fancy_data'];
        Yii::app()->session['fancy_data'] = $data;
  
        //do your thang, gurl...
    }
}


This is what I do, and unless there is some security flaw I'm missing, it should work fine.



I've changed my codes to your method. But the error still persist.

I can echo out the session value in all the pages. But when I clicked the browser "back" button at the "result details" to go back to the "result" page, the error page still comes out. But when I refreshed the error page, the page will appear with the echoed session value. So I think the session is there just that I don't know why the "webpage has expired".

Could it be because the "result" and "result details" are of different modules that cause the "webpage has expired" error?
0

#6 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 665
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 11 November 2012 - 02:07 AM

Hi,

Please post your view so people here can help you better.
0

#7 User is offline   pinky 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 51
  • Joined: 27-July 12

Posted 11 November 2012 - 04:59 AM

View PostRodrigo Coelho, on 11 November 2012 - 02:07 AM, said:

Hi,

Please post your view so people here can help you better.


Ok. My codes are as follows.

View in "search" module with buttons to link to "projprofile" module's index page through the controller:

<?php echo CHtml::button('View', array('submit' => array('default/viewProject','project_id'=>$data->project_id), 'class'=>'viewButton')); ?>


Controller that will bring you from "search" module to "projprofile" module's index.php:
public function actionViewProject()
{
	$project_id = $_GET['project_id'];
	$this->redirect(array('/projprofile', 'proj_id'=>$project_id));
	
}

0

#8 User is offline   pinky 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 51
  • Joined: 27-July 12

Posted 16 November 2012 - 06:19 AM

I'm not sure what I'm doing is right or not.

Probably I can explain in detail what I'm doing and maybe you all will have solutions or workarounds to the "document expired" problem.

I have a "search" module and in its view page, I have a button that I want to link to a "projprofile" module's view page. However, the "projprofile" module's view page would require parameters such as the project_id, in order to retrieve values from the model(database) according to the project_id, to display in the "projprofile" module view page.

Currently I have a button in the "search" module view page that calls the "search" module controller's method. The "search" module controller's method will then redirect to the "projprofile" module's view page by passing the project_id.

The button can be linked to the "projprofile" view page. But when I clicked on the browser's back button, it will give me "document expired" in firefox, "confirm form resubmission" in chrome or "webpage has expired" in IE.

Am I using the proper method of displaying another module's view page? Is it because I'm using a wrong way that causes this problem?

Search module view page button:
<?php echo CHtml::button('View', array('submit' => array('default/viewProject','project_id'=>$data->project_id), 'class'=>'viewButton')); ?>


Search module controller's method:
public function actionViewProject()
{
     $project_id = $_GET['project_id'];
     $this->redirect(array('/projprofile', 'proj_id'=>$project_id));
        
}

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users