I have a form with a "Print" button on the page. When the user clicks this it doesn't actually print but opens a condensed version of the page, passing the field contents with php. On the new (condensed) page I capture the load of the page in js and when it occurs issue the command print(). This works fine.
But once I've done this (printed) I would like to return to my original form. I've tried
if (print()) history.back()
print()
history.back()
neither seems to work. As an experiment I put the following code at the bottom of my condensed page that prints...
<FORM>
<INPUT type="button" value="Click here to go back" onClick="history.back()">
</FORM>
Clicking on the resulting button does exactly what I want... clears the form and returns me to my original.
I just don't what to
a) print the form with that button on it
b) require user input after the printing.
So... can anyone point me in a way of making history.back() work outside of an onClick construct?
I have a webpage popup (lets call it POPUP) which refreshes the opener window (this one we call PARENT) when we close it, saying we want to save data. For this, we use
top.oWndOpener.refresh();
When we don't want to save the POPUP data, we just close the popup and don't refresh the PARENT. In the PARENT we have a "Back" link which executes a simple
history.back()
The problem is: If we refresh parent, we need to go back 2 pages, because the refresh method adds another page to the history. But we have no (easy) way of knowing in the PARENT if it had been refreshed. With this, our users are forced to click two times in the Back link.
Is there anyway of going back to the previous page, no matter how many refreshes happened in the current one ?
I used <input type="button" value="Back to Correct" onclick="window.history.back();"> to go back to the previous page is working, but if i use the as below instead, it does not work. what did I do wrong?
I'm attempting to use the javascript 'history.go(-1);' to make a page automatically return to the last page a user visited. At the moment, I can get this to work ONLY if I insert a link into the page.
What I want to happen is, the page autmatically sends the user back to the previous page after a set time. I have this for my JS:
function backtomusic() { window.location = history.go(-1); }
And in the body section of my page I have:
<body onLoad="setTimeout('backtomusic()', 3000)">
When it runs I get an error saying 'undefined' in the browser address bar
Have a slideshow navigation and want to put a DOM onubtrusive JS that finds the <a> in <li id="nav-back">and executes history.back() with a onclick handler. No worry about JS disabled because then I use a other link that is hidden when JS is enabled ...
Some questions-ideas
What do i need to put in the <a href="??"> of <li id="nav-back"> ? And the script I started see below, should it be written like that ?? History.back() works perfectly cross-browser in DOM capable browsers ??
This is the HTML
<div id="navwrap"> <ul id="nav"> <li id="nav-prev"><a href="#" title="go to previous image">previous</a></li> <li id="nav-back"><a href="#" title="go to overview of images">back to overview</a></li> <li id="nav-forward"><a href="#" title="go to next image">next</a></li> </ul> </div>
Is this how to do go about it if (!document.getElementbyId) {return;} var backButton = document.getElementbyId('nav-back').document.getElementBytagname('a')
backButton.onclick = history.back(); }
Is it possible to show in the title tag that last history entry ?
On a page of mine a user might submit data several time, which adds an entry to the history each time (similar as http://www.google.com/trends?q=iPod...o=all&date=all). Yet later the user wants to go back to the previous page in one step. Now is it possible to loop backwards through the history until a different page is reached? Has anybody coded something like this?
just trying to get this to work. Code is inserted into document head. I am using this on a confirmation page that comes up after submitting a form, I want the page to redirect to the previous page. I am also wanting to add a timer indicator to the page as feedback to the user.
I have a photo gallery that cycles images using custom buttons and replacing images from an javascript array. I do this so that I don't reload the page each time, just put up the next image so the next image (preloaded) appears instantly. I change the URL to include the image name so that it can be saved, linked, sent etc.
If I load the page and cycle through some pictures and then use the back button I can't find a way of detecting this and putting up the previous image - it just changes the URL in the browser and eventually unloads the page when it should.
I have a page which I've just added a div to so that it will show/hide 'advanced' search options. The problem is that I've not found a way to 'show' the div when a history.back() command is used.
First off I had it so that the div style was display:none. Site user would click on 'Refine Your Search' to show the additional fields. That worked fine, but the customer wants it so that when they go back from the search results to the search page it 'remembers' which boxes were ticked.
The problem is that when it does the history.back(), the 'Refine Your Search' radio button is selected but the div with the controls doesn't show. So, thinking I was clever I thought of an alternative way to skin this cat .
Instead of having the style of the div set as display:none I would set it as display:block and then have a javascript function that would set it to display:none when the page initialised. That way the 'default' state for the div would be display:block.
No dice...even though in the source code it shows the style of the div as being display:block the div STILL doesn't show.
The search page is at: [url]
Click on 'refine your search', tick a box (e.g. air conditioning) and then click the search button. Then at the bottom of the results page click the link to go back. You'll see the problem.
Im trying to make a back button that reloads the previous page the user was at. The back button will be on a small top frame and the page that needs to be controlled will be in the main frame.
The top frame is just a navigation system, and all pages will be loaded in the main frame. Im trying to use this Code:
I'm looking to have a lightbox pop up when a user clicks the Back button in their browser rather than just navigating back. The purpose is to ask a question with a Yes/No answer, and if they click No, I allow them to go back. The only thing I've found anything like this is the onUnload event, but that doesn't prevent them from going back. How should this be handled?
I am trying to write a script that uses the IF statement to see wether or not a user clicked the back button to come to a page, and then if it's true to not let the page load and kick them back X number of pages (say 4) This is what I have so far:
Is there a way to obtain the last page visited? I don't want to go to that page, I just want to be able find out what page they came from, the url of that page. Is this possible?
I'm having a bit of a problem with IE and the history.go(-1).
I have script in php that adds a new vehicle to the DB. Before adding it checks to see if all fields are populated. If not it displays an error message and then provides a back button in the form of an submit button and onclick="history.go(-1);return false;
In IE when I click back I get an error message ... see attached screen dump.
I click ok and then click back ... it says the same error message.
I click the back button once more and it then takes me 2 pages back from the current page.
I dont experience the same problems in Firefox ... all works great.
I also have header("Cache-control: private"); //IE 6 Fix set at the top of the page.
I have been trying to utilize a pre existing snippet of JS that makes a call to some PHP, where the PHP echo's out the answer, namely a dynamic quick search output, that gains its data from an xml file (which works as expected) and thought I might be able to rework the code to work for my altered purpose (which has been a disaster at every attempt) which is as follows:
1. I have a JS file called call4section.js - JS that has a string (str) value assigned (could be number or a combination of numbers and letters) which is passed to a PHP script called call4section.php.
2. The PHP script takes receipt of the string and finds a match within an XML file for the entry under <reference>.
3. The XML file has a format as follows:
<pages> <note> <section>value</section>
[code]....
And well, I dont seem to be able to get any further forward with it. Effectively, I can echo out the $reply (if it worked I think), but my stumbling block is sending the starting string, with the JS expecting some reply sent from the PHP.
We use a three-window frameset for online manuals. The "main" window contains our document. Since the documents have hyperlinks between them for related topics, we have "return" links built into a navigation bar on some of the pages. Most of the time these work fine, but if the person clicked on the top or left frame before clicking on the "return" link, the wrong frame is changed.
Does anybody know how to alter the script so that only the main document window is in focus? Here's the script we use in the page:
<a href="javascript:history.go(-1);">Back</a>
By the way, this is for a company Intranet - with all users on IE5.5 as a minimum.
is there neway using javascript that you can detect if a vistor has clicked a link?
the reason i ask is that i need to make only certain links on an area of a page to be a certain color if they have been linked, but other ones remain unaffected. i only have control over a few links, as it is an asp application for someone to download and have inside their pages
I have an Apache PHP enabled webserver and want to know from where users are coming from. Understand I want the last surfer's browser visited url. I imagine I can do this with some kind of interraction between 2 scripts : one client side, one server side. The client one send the URL and the server one write it in the right log file....