473,796 Members | 2,565 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2266
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_N O_@_SPAM_hotmai l.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='JavaS cript' type='text/JavaScript'>";
print "<!--\n";
print "window.locatio n =\"$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_N O_@_SPAM_hotmai l.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
2234
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 specified. What is the value of an unspecified HEIGHT or WIDTH attribute. How do I dynamically set the attribute to unspecified, after having previously used the <IMG> with explicit HEIGHT and WIDTH attributes? - David
8
18777
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 access databases. The server is a Dell Dual 2.4Ghz XEON with 512Mb Ram. Every few days I get the error 'HTTP/1.1 New Session Failed' and the server stops showing the sites. It comes right after a bit and then the error comes back. I
1
1716
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. Is there a simple fix for this? TIA Neil
2
1817
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 the state after the OnLoad event
1
3094
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 void Page_Load(object sender, System.EventArgs e) { Page.RegisterHiddenField("__EVENTTARGET","SomeButtonOnThePage");
3
1764
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, session information is lost and my app forgets what rules a user has. I'd rather not recode to read this from the database for every page, but I wonder if I have no other choice. Anyone else notice the Session resetting?
4
4084
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 have to click it twice to do the job (the first submit resets the sessions but this it too late to change the field values, which requires another submit to pick up the new session values). Problem is I cant think how to accomplish the resetting of...
1
7188
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 not resetting the IIS Session timer. Thus, if the default IIS Session Timeout of 20 minutes is used, our logged-in users are always receving Session timeout in 20 minutes, regardless of what UpdatePanel activity is happening on the .aspx page. ...
1
4117
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 the page you're looking at. Now, if the links have never been visited before, they are blue. If you hover over the links they turn light blue. I want the user to be able to select the link and it take you to that page. On that page, I want the link...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9531
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10237
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10187
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10018
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6795
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5578
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3735
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.