/    Sign up×
Community /Pin to ProfileBookmark

Javascripting for html web page

I need help with a bit of java scripting for a web page. I have my page set to activate a cookie on their first visit, anddirect them to a small ad that helps me maintain the site. For teh rest of the day, they dont see that add again, because I only get credit for a view once a day. However, a lot of people are going around this by going directly to the main site. Is there any way to script it so that on the main page it checks for that cookie, and if it doesnt exist, redirect them to my First Page? Or to keep them from entering the page unless they came from a certain url?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@pyroMar 11.2003 — How about something like this:

if (document.cookie == "")

{

window.location = "firstpage.htm"

}
Copy linkTweet thisAlerts:
@ValareosauthorMar 12.2003 — That was the first thing I tried, but It was giving me javascript errors. Perhaps Im doing it wrong. the page I want to keep them from getting to if they dont have a particular cookie is not the same page that loads the cookie
×

Success!

Help @Valareos spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...