Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Javascript check page

Posted on 2010-09-24
5
Medium Priority
?
286 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:
Gurvinder Pal Singh earned 2000 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:Gurvinder Pal Singh
Gurvinder Pal Singh earned 2000 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:Gurvinder Pal Singh
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

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

721 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