Scripts
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb Site ManagementScripts

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 16th, 2010, 06:37 PM
dean1986 dean1986 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2010
Posts: 1 dean1986 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 58 sec
Reputation Power: 0
Question Script to save iframe source (cookie?)

hi,

i would be very very grateful if someone can help me out here.

i a iframe on my webpage, who's src location if the same domain. as in my other page under the same domain.

what i'd like to do is when a visitor leaves my site, i want the src of the iframe to be saved and when the same visitor visits the site. that last src will load within that iframe.

is this possible.

many many thanks.

Reply With Quote
  #2  
Old August 14th, 2010, 09:49 AM
ScriptGuru ScriptGuru is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2010
Posts: 10 ScriptGuru User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 2 m 36 sec
Reputation Power: 0
Depending on ur website if it is just html or is php you can use
w3schools
http://www.w3schools.com/JS/js_cookies.asp
which has some snippets
in said snippets has a getCookie(c_name) function
which you can use to get the cookie you are looking for...
Code:
<html>
<head>
<script type="text/javascript">
function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
}
</script>
</head>

<body>
<iframe src="<script>getCookie(url);</script>" extrastuff="here" onchange="setCookie(url,this.src,1"></iframe>
</body>
</html>

i'm hoping you get the idea...
i havn't tested the above coding but i'm sure you can figure what is going on there.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb Site ManagementScripts > Script to save iframe source (cookie?)

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap