Solved

Looking for reusable Javascript & Cookie support add-in for webpage

Posted on 2009-07-02
6
157 Views
Last Modified: 2012-05-07
I am looking for a simple piece of client side code that can be included in my webpages that runs onload to detect whether the user has javascript and cookies enabled, and then sends them to a page that explains how to enable these items based on their browser type and version if either is not. I am sure that I could write this myself, but it seems that there must already be "library" item that I could use to include in my websites that would be more comprehensive than I could create.
0
Comment
Question by:Rich
[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
  • 2
  • 2
  • 2
6 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 24771858
to check for javascript you can use the  tag
to chek if cookies are enabled, you need to force the browser to send a request after your application has set a cookie, this is usually done with a meta redirect or using webbugs (1-pixel images)
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 24772219
Here


<script type="text/javascript" src="cookie_utils.js"></script>
<script type="text/javascript">
if (!isCookieEnabled()) location.replace('explaincookies.html')
</script>
<noscript>
It seems you have turned javascript off. Please read <a href="jsexplain.html">here</a> what you are missing out on
</script>

Open in new window

cookie-utils.js.txt
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 24772304
just a pedantic note:
you cannot reliably test for cookie functionality with javascript, as a browser may disallow settings cookies with scripting; for example mozila with
  user_pref("dom.disable_cookie_set", true);
0
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 

Author Comment

by:Rich
ID: 24772629
mplungian,

That is part of what I am looking for, and in rereading my question, maybe not obvious, but mostly looking for the content of explaincoolies.html and jsexplaine.html that will check for users current browser and then provide the specific instructions for enabling cookies and/or javascript. Anything you know of that includes that functionality?
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24772881
0
 

Author Closing Comment

by:Rich
ID: 31599366
OK, thanks. I will use the code and try to come up with the instruction part myself. Maybe keeping in generic will suffice for now. I am just suprised that there isn't some prepackaged source for this pretty standard need.
0

Featured Post

Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

Question has a verified solution.

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

It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

707 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