FCKeditor is very useful tool for allowing the user to enter the formatted text in a webpage without having knowledge in HTML.
If we click Back button in the browser once after entering content using FCKeditor, the browser won't go to actual previous page, instead it will remain in samepage with the empty content. We noticed that clicking Back button two times displays correct previous page.
To avoid this issue, we have used below workaround.
- We provided a separate back button in the webpage. In the onclick event of this button, we called a javascript method to simulate clicking of browser back button two times.
- Find below the sample code.
<button onclick="javascript:history.go(-2);">Back</button>
And also, we have noticed that sometimes (e.g. after saving the content) we need to click browser back button 4 times to go the previous page.
To handle this scenario, we can enhance the above sample code by replacing -2 with a PHP variable whose value should be set either -2 or -4.
for example,
- pass a querystring parameter confim=updated once after finishing the save operation.
- use below code to assign value for a php variable based on the flow.
if (isset($_GET['confirm']))
{
$backcount=-4;
}
else
{
$backcount=-2;
}
- Now this php variable can be used in our previous sample code.
<button onclick="javascript:history.go(<?php echo $backcount;?>);"> Back</button>
updates on May 08:
It seems we need to use "return false" as below to avoid issue in some browsers (IE 7 and FireFox).
<button onclick="javascript:history.go(<?php echo $backcount;?>);return false;" > Back</button>
More Articles...
Shop at Rajamanickam.com | Birthday Gift Idea? | Hire me for $6 per Hour
Get 3 useful ebooks for Rs 99 in India and $5.99 globally
Get a 75% commission | ChatGPT and and Google Gemini for Beginners (Use Discount code QPT)
Tuesday, April 28, 2009
Search This Blog
Art of Talking to AI | Tech eBook | Dream Big | Listen to Dream Big
Today's Deals | Timesheet | Products | 3 ebooks for $5.99 / Rs 99 | Earn 50% commission
About | Privacy | Follow | TOS | WhatsApp | Contact
I may earn a commission from Amazon affiliate links
Today's Deals | Timesheet | Products | 3 ebooks for $5.99 / Rs 99 | Earn 50% commission
About | Privacy | Follow | TOS | WhatsApp | Contact
I may earn a commission from Amazon affiliate links
No comments:
Post a Comment