• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

how can i add to this code a previous page link using javascipt.

Hello i need to add to this javascipt condition back to previous page or history -1 and i need to check if the previous page was not in the domain http://www.audiomind.net get back to index page http://www.audiominds.net please give mthe full code based on this query below
if ( notification == "b")
	//add here the navigation details 			
 
 }
				else
				{
				document.getElementById("notification").innerHTML=notification;
				document.getElementById("txtstate").innerHTML=content;
				}

Open in new window

0
Audiominds
Asked:
Audiominds
  • 2
1 Solution
 
ASPSQLServerCOMCommented:
use

Hisotry object  - history.previous method
previous Property
The previous property contains the complete URL of the previous element in the History list, and is the equivalent of the URL the user would go to if they selected Back in the Go menu.
 
Syntax: history.previous


http://www.exforsys.com/tutorials/javascript/javascript-history-object-properties-and-methods.html


0
 
AudiomindsAuthor Commented:
thanks ASPSQLServerCOM can anyone help add the code to my scipt showed above as i am a newbie with these stuff .
thanks.
0
 
ASPSQLServerCOMCommented:

var url;
url=history.previous;
if(url.substring(0,24)<>'http://www.audiomind.net')
{
window.location = "http://www.audiomind.net"
}
 
are you looking to disable to back button? there are couple of ways to do that too

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now