I have been playing around with the history.length property in JavaScript and have come across a bit of a problem I don't understand.
On my localhost machine I have two pages - Page A and Page B that both have one line of script being:
When I load new browser tab and open page A the page says I have 1 URL in history. I then open page B in the same tab and it says I now have 2 URLs in history list. Thats fine.
However, I then tried using iframes. I created an iframe with src to Page A and then changed the src of the same frame to Page B. The problem is instead of returning value of 2 (i.e. Page A and Page B) it says only 1 URL in history list but I opened two pages in the same iframe?
<body>
Does the history.lenght property have to be accessed differently for the iframe history something like document.getElementById('myframe').history.lenght ?
Is there a way you can control history on a specific iframe?
Let say you have these file
index.html
a.html
b.html
As you can see it's just very simple page w/ 2 frames. I created 2 button that is specific to iFrame's history but... it does not work... Yes, it does perform "back" but at the the "top" level and not at specific iframe.... I tried this on both firefox and chrome..same behavior..
I want to know the length in pixels of a document embedded in a iframe. The way I go seems to work under IE but not under Firefox (about other browsers I'll see later). Code:
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.
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 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 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....
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 have a one-page site that uses 4 different links to show or hide 4 different content DIVs. Because each piece of content isn't a separate page, a user who clicks the back button after clicking one of my links will be taken away from my site. Is there a way for me to use a JavaScript function to write a history entry each time they show/ hide a layer so that if they do click the back button they aren't navigating away from my site? I've noticed that this only affects Internet Explorer...I do not need this for FireFox.
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 ?
Is it possible to force an entry into the browsers history without actually changing pages? I want to change the history based on a tabbed interface so that when linking away from one of the tabs a back button will return me to the correct tab or even the browser back button for that matter.
to disable back button , its working.when i go to back list and click previous histories it shows data. so data hiding is important to my project. how can i delete browser history
I'm designing a web site and I designed an error page with .htaccess so that when someone types in an incorrect URL, it takes them to my customized page. Well, I used server-side programming to make it log the bad URL and check against a database if the there is a good URL matching the bad one. If so, it redirects to that page instead of giving the error. It's a good, well-written script done by me, I'll give it to anyone that requests it.
What I want to know is if JavaScript can prevent a page from being logged in the visitor's browser history.
You see, when they click the back button, the revisit the error page and it relogs the bad URL.
My clients have a, "Family Violence" Prevention website and they have asked me to create them an "Exit" button so that the users could escape the page quickly if they heard their abusive partners.
I added the "javascript:document.location.replace("http://www.google.com")" to the button to disable the back button, but it only works on the last page viewed.. if they viewed more than one page on the website it takes them back to the page before the last page viewed.Is there a way to remove all pages from a domain name? or remove all browser history before that?