473,378 Members | 1,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

resetting browser?

Hi...

I'm getting to grips with custom error handling, and am wondering if it is
possible to somehow reset all the content already sent to the browser, and
send some new stuff in its place.

For example, if I'm looping through a database, and I've already written 10
records to the browser, and then an error occurs, is it possible to send a
command to the browser that makes it drop everything it's received thus far,
and then just have it print the output of my custom error handling function
instead? I'm guessing not, because I think only headers can do such things,
and they've already been sent, but it's worth asking!

P.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003
Jul 16 '05 #1
3 2251
The Plankmeister wrote:
Hi...

I'm getting to grips with custom error handling, and am wondering if it is
possible to somehow reset all the content already sent to the browser, and
send some new stuff in its place.

For example, if I'm looping through a database, and I've already written 10
records to the browser, and then an error occurs, is it possible to send a
command to the browser that makes it drop everything it's received thus far,
and then just have it print the output of my custom error handling function
instead? I'm guessing not, because I think only headers can do such things,
and they've already been sent, but it's worth asking!


Turn output buffering on. All output goes in the buffer and is output
when your script terminates. You can clear it if you wish before then.
It can hog memory on the server though if there's a lot of output.

http://uk.php.net/manual/en/function.ob-start.php

Jul 16 '05 #2
On Thu, 28 Aug 2003 10:39:21 +0200
"The Plankmeister" <plankmeister_NO_@_SPAM_hotmail.com> wrote:
Hi...

I'm getting to grips with custom error handling, and am wondering if
it is possible to somehow reset all the content already sent to the
browser, and send some new stuff in its place.

<snip>

Not quite "resetting" the browser, but an option:

You may want to try somesort of javascript function.

<?
$error_page = "http://blah.com/error.php";
if($error)
{
print "<script language='JavaScript' type='text/JavaScript'>";
print "<!--\n";
print "window.location =\"$error_page\"";
print "//--></script>";
}
?>
Matt
--
Quispiam Power Computing | "There are two major products that come out
Pendle Hill, Australia | of Berkeley: LSD and UNIX. We don't believe
+61 2 9688 2894 | this to be a coincidence. "
www.quispiam.com | - Jeremy S. Anderson
Jul 16 '05 #3
"The Plankmeister" <plankmeister_NO_@_SPAM_hotmail.com> wrote in message news:<3f***********************@dread15.news.tele. dk>...
Hi...

I'm getting to grips with custom error handling, and am wondering if it is
possible to somehow reset all the content already sent to the browser, and
send some new stuff in its place.

For example, if I'm looping through a database, and I've already written 10
records to the browser, and then an error occurs, is it possible to send a
command to the browser that makes it drop everything it's received thus far,
and then just have it print the output of my custom error handling function
instead? I'm guessing not, because I think only headers can do such things,
and they've already been sent, but it's worth asking!

P.


Your idea of how PHP (or any other language for that matter)
constructs HTML pages and sends them to the client's browser is
entirely wrong. Your PHP script may construct the web page in stages,
but it is only when it is complete that it is sent to the browser.
Just because your code has finished constructing a bit of HTML does
NOT mean that it is already being displayed on the client's device.

You do NOT write directly to the browser, you write to an output file.
It is only when the file is closed that it is sent to the browser.

Tony Marston
http://www.tonymarston.net/
Jul 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: David D. | last post by:
If an <IMG> specifies a WIDTH but not a HEIGHT, then height is internally determined so as to maintain the image's aspect ratio. Aspect ratio is also preserved if HEIGHT but not WIDTH is...
8
by: riprod | last post by:
Someone in the IIS newsgroup suggest I post this here, so sorry in advance for the cross posting. I have a Win 2003 SP1 with IIS 6 and host about 40 websites, most of them useing ASP/VB with...
1
by: Frantic3d | last post by:
I just started using Access' Template file "Time & Billing Database" Well among other items I need to change the biggest right now is resetting the Client, Employee, Project ID #'s to start at 1. ...
2
by: DeveloperPDX | last post by:
I am creating a page and I need to add a reset button (like you would with HTML forms). Is there any way to do this other than resetting individual controls? Basically I need to page to return to...
1
by: Matthew Wieder | last post by:
Hi - I wanted to capture the enter button on a form since I have a datagrid with the first column being a delete button and if someone hits enter it deletes the first record. I coded: private...
3
by: No One | last post by:
This seems to be related to the ViewState error that is now starting to plague ASP.Net apps. When the Application Pool is recycled, the Session seems to be getting reset. When this is done,...
4
by: Ian Davies | last post by:
Hello I am struggling for a solution to clear some fields on my webpage that takes their values from some sessions My solution below works when the button is clicked twice. I sort of know why I...
1
by: =?Utf-8?B?TWlrZSBNY0FsbGlzdGVy?= | last post by:
I have not been able to find anything about this problem, so it must be configuration on our server, somehow... What we are observing is on Windows Server 2003/IIS 6 our AJAX UpdatePanels are...
1
beacon
by: beacon | last post by:
I'm looking to reset the visited link color once another link is selected. Also, once that link takes me to a particular page, I want the font-weight for that page to be bold to indicate that it's...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.