Solved

Javascript check page

Posted on 2010-09-24
5
284 Views
Last Modified: 2012-05-10
Hi I'm wondering if i have many page for example 1.html, 2.html etc is there a way in JScript to check if they have visited every page?
0
Comment
Question by:bobby101
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 33752523
when ever you visit that page, create a cookie for that page. something like
pageExample1Visited=true;

So you can check if a cookie exists for a page, that means it is visited.
0
 
LVL 4

Author Comment

by:bobby101
ID: 33752722
new to JScript, please explain in depth
0
 
LVL 40

Assisted Solution

by:gurvinder372
gurvinder372 earned 500 total points
ID: 33752862
Sure,
1) when you visit a page, check for the existence of a cookie for that page.
http://plugins.jquery.com/project/Cookie
Say you have visited Page1.html, so you will check for the existence of cookie 'Page1FirstCookie'.
2) If the cookie exists, it means it is not your first visit.
If the cookie doesn't exists, that means this is your first visit to this page. So you need to create this cookie now, so that next time you visit here, you can check if the cookies exists or not.

Let me know if this doesn't help


0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 33786424
@bobby101: please let me know if your problem is resolved.
0
 
LVL 4

Author Comment

by:bobby101
ID: 33787509
got it to wrk
function checkPages(div) {
	var div = document.getElementById(divId);
	
	page1 = getCookie('page1');
	page2 = getCookie('page2');
if (page1 == 'visited' && page2 == 'visited'){
		div.innerHTML = 'All pages visited, you can advance to <a href="example.html">next</a>';
		
	} else {	
		div.innerHTML = "Please visit all pages before continuing.";
	}
}

Open in new window

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Node.js 11 82
SSRS - Powershell 7 81
Keyup listener getting fired on initial page load 1 53
Error Handler 8 43
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
This article discusses how to implement server side field validation and display customized error messages to the client.
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question