Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Smart redirection

Posted on 1998-10-12
3
Medium Priority
?
168 Views
Last Modified: 2013-12-25
I currently have a powerbuilder application that runs off our corporate intranet via a plugin. This application, though, requires a one-time installation for the plug-in to work. What I would like to do is when the user clicks the hyperlink to run the application, have a way to detect (cookie ?) whether or not it has been installed. If it has, send the user to the page that has the plug-in, otherwise, redirect the user to the installation instructions for the plug-in. Our standard browser is IE 4.01 if that makes any difference. Any ideas???
0
Comment
Question by:aguldber
[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
3 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 400 total points
ID: 1855662
You would have had an easier time with Netscape which can detect the presense of the plugin.

A cookie is indeed a way to do it:
In the installation pages have

<SCRIPT LANGUAGE="JavaScript">
nextyear = new Date();
thisyear = nextyear.getYear();
if (thisyear < 100) thisyear += 1900; // Millennium
nextyear.setYear(thisyear+1);

// The next is on one line
document.cookie = 'ourplugin=installed; expires=' + nextyear.toGMTString + 'path=/; domain=myserver.com';

/* If the plugin installation page is on another server you cannot do this - if it is not in the same domain forget cookies */
</SCRIPT>

on the page(s) using the plugin have this in the head:

<SCRIPT LANGUAGE="JavaScript">
theCookie = '';
if (document.cookie) theCookie = document.cookie;
if (theCookie.indexOf('ourplugin=installed') ==-1) location = 'install.html';
</SCRIPT>

Enjoy,

Michel
0
 

Author Comment

by:aguldber
ID: 1855663
Let me make sure I understand this before I approve this answer...

On the page that contains the installation plug-in, insert the following code in the html head.

<SCRIPT LANGUAGE="JavaScript">
 nextyear = new Date();
 thisyear = nextyear.getYear();
 if (thisyear < 100) thisyear += 1900; // Millennium
 nextyear.setYear(thisyear+1);

 // The next is on one line
 document.cookie = 'ourplugin=installed; expires=' +    nextyear.toGMTString + 'path=/; domain=myserver.com';
</SCRIPT>


on the page that uses the plugin have this in the head:

<SCRIPT LANGUAGE="JavaScript">
theCookie = '';
if (document.cookie) theCookie = document.cookie;
if (theCookie.indexOf('ourplugin=installed') ==-1) location = 'install.html';
</SCRIPT>

I'm not real fluent in JavaScript, could you walk me though what the code does in the first script. Thanks for your help...
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1855664
<SCRIPT LANGUAGE="JavaScript">
nextyear = new Date(); // Create a date object
thisyear = nextyear.getYear(); /* get the year (98 in version 3 browsers) */

if (thisyear < 100) thisyear += 1900; // Millennium fix
nextyear.setYear(thisyear+1); /* Update the date object */

// The next is on one line
document.cookie = 'ourplugin=installed; expires=' +    nextyear.toGMTString + 'path=/;domain=myserver.com';

</SCRIPT>

The cookie consists of

name=value;

expires=expiry date of the cookie in
GMT format : Mon, 11-Oct-1998 22:25:00:00 GMT

path= web server directory allowed to read the cookie, / all directories from root and down may read it - leave it out and only files from same directory as the page that set the cookie may read it

domain= servers that are allowed to read the cookie, leave it out and only the originating server may read it, but if you set it on is.myserver.com and sales.myserver.com needs to read the cookie, you need this property.

Michel
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Suggested Courses

636 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