close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Redirect based on cookie value

Thread began 9/21/2009 10:59 am by hirshj389512 | Last modified 9/22/2009 4:03 pm by hirshj389512 | 5213 views | 10 replies |

hirshj389512

Redirect based on cookie value

On of features is the ability to redirect to a web page based on a cookie value

I can notfind any documentation for that.. in fact there is virtually no documentation

I am using a swf intro for a web site (no log on) and want to be able (if possible) to avea cookie remember that the person does NOT want to see movie again

Sign in to reply to this post

Dani Chankhour

I will out line the steps you need to take to set up the redirect:

- in DW open the behaviors panel (Window -> Behaviors)
- Click the + button and look for WA Cookies Toolkit, and then look for 'Redirect Based on Cookie'
- in the Wizard you can type the cookie name and the url where you want the user to be redirected to.

This assumes that you already have a cookie created.

Sign in to reply to this post

hirshj389512

No Joy

This is what has been generated by your extension


<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
setcookie("NoShow", "1", time()+(60*60*24*30), "/", "", 0);
}
?>
<script src="WA_Cookies/Cookies.js"></script>
<script type="text/javascript">
<!--
function WA_cookieRedirect(CookieObj,Location,Alike,CookieName,CookieValue,RedirectTo,NewWindow) {
if ((CookieObj.getValue(CookieName)==CookieValue)==Alike) {
if (NewWindow)
window.open(RedirectTo);
else
Location.location.href=RedirectTo;
}
}
//-->
</script>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
<label>
<input name="NoShow" type="checkbox" id="NoShow" onclick="WA_cookieRedirect(WA_CookieObj,document,false,'novideo','1','/mainindex.html',false)" <?php if (!(strcmp(((isset($_COOKIE["NoShow"]))?$_COOKIE["NoShow"]:""),1))) {echo "checked=\"checked\"";} ?> />
Skip Video</label>
</form>


IfI check the box it jumps whoppee....I would take it from the script language that i Have created a server based ever..

I want to create a client based cookie so wnen client comes back it does what he wants

Sign in to reply to this post

Dani Chankhour

The redirect needs to be done on the body tag of the page, so the redirect will happen when the page is loading.

Please select the body tag and apply the redirect.

In addition , you will need to set the cookie value when the form is submitted. So when the form tag select, set a cookie a value (Behaviors -> Cookies Toolkit). This will set the cookie value when the form is submitted.

I have attached a working example which could help you with the steps.

Attached Files
untitled.php.zip
Sign in to reply to this post

hirshj389512

divine revelation

Ican see the mistake I made on timing on the body


the submit process I have no idea were it came from, I see noting close to it in what you guys call documentation and in fact itis dramatically different from previous instructions


the only way it will appear I can duplicate is to hand code

Sign in to reply to this post

hirshj389512

mystery script

ok I was partly wrong

feeding te file back into the extension..I was able to see ow it works granted it is nothing like any documentation i can find or the previous direction


the stil leaves the question of the following scripy

<script name="WACookieDis">
document.write(WA_CookieObj.getValue("new"));
</script>

and were did that came from??? It obviously is an important player as it is get the value of the variable...

Sign in to reply to this post

Dani Chankhour

You can just ignore that code. That code writes the value of the cookie to the page. I only added that code when i was testing to see the value of the cookie.

Sorry for the confusion.

Sign in to reply to this post

hirshj389512

aah

OK...I now see..your example helpedbut completely contradicted that early instructions and documentation

Sign in to reply to this post

hirshj389512

Documentation a little week

Ok in the last 24 hours I have recreated your example which does work


The documentation provided on the web site is useless. The tip you provided on the body helped


this is what i finally did

In Dreamweaver CS 4
create php page
add form in body (Insert -> Form)
change method = post
name "your form"
add form ID in properties
add form label (Insert->form->Label)
add checkbox inside value tag)Insert->Form->checkbox
Leave Type checkbox
Set Name "urcheckbox"
Set Value "urcheckbox"
add form value tag (Insert ->Form -> Label)
add button (Insert ->Form -> Button)
chnage type to submit
set value = submit
Higlight the button
use properties to add id "submit"
select form up to first label
use behaviors
From the Server Behaviors panel, choose Add.
Choose WA Cookies Toolkit > Set Cookie Value. OnSubmit
enter cookie name ("urchoice")
select body
goto behaviors
Choose WA Cookies Toolkit > Redirect Basedon cookie
select cookie (name as in above)
set cookie value to true
set destination

its done


The on line documentation indicated that there was no problem if you didn't have a form
not necessaryily true..

You said that you assumed that cookie was already made... if so you don't get the code you generated

the cookie is apparently created when value is first set

Sign in to reply to this post

Dani Chankhour

In regard to documentation, all of our documentation for Cookies Toolkit will be listed here:

cookies-toolkit/

I understand that we don't have documentation available for how to set a redirect based on a cookie. But i think from here i think we should be able to create one.

I will inform our documentation team.

Thanks.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...