473,662 Members | 2,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

document.referr er result being truncated!

1 New Member
hope someone can advise! . . .

i'm using this code...

Expand|Select|Wrap|Line Numbers
  1. <SCRIPT LANGUAGE="JavaScript">
  2.  document.write("<INPUT type=hidden NAME=referrer VALUE=" + 'document.referrer' + ">");
  3. </SCRIPT>
to generate a hidden field to be submitted with a php formmail script, so i know from which url the visitor has filled in the form. this works well, except for the fact that the url is truncated/corrupted in some way at the end so this....

gallery/index.php?level =picture&id=256

ends up like this...

gallery/index.php?level =picture&id%6

this is obviously a pain in the arse as the info is of no use unless its the the full, unabridged url!

any advice appreciated!

many thanks :)
Oct 9 '06 #1
1 2146
acoder
16,027 Recognized Expert Moderator MVP
Use encodeURI() or encodeURICompon ent() and decodeURICompon ent() to encode/decode the URL.
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.  document.write("<input type='hidden' name='referrer' value='" + encodeURI(document.referrer) + "'>");
  3. </script>
May 19 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3239
by: Daniel | last post by:
Hi, All! I have a problem - I manage two websites, with two different style sheets (one for each site), but they both share hte same public message boards and I want to change the CSS used by the forumn template depending on which site the user came from - this must be done in JScript, as the boards are hosted offsite and we cannot edit the serverside language. Unfortunately, its been over two years since I undertook a serious JScript...
9
3075
by: goks | last post by:
I'm using document.referrer method for tracking visits on my site. But it seems that, when someone finds my site with google, this method returns only: "google.com/search?q=xxxxx" (good) or "google.com/search?hl=en" (bad) or "google.com/search?sourceid=navclient" (bad) That meens, it returns only first parameter sent to google. "hl" defines
1
2986
by: kuok benny | last post by:
Hi, I am trying to use the document.referrer to get the referrer of my home page. Occationally, I get the value of 'blockedReferrer'. Actually how this happen, how the client blocked the function of document.referrer. I just want to verify how this could be done within the browser e.g. IE, Netcape and so on... what Internet option have them activate or not activate to make me to have the value 'blockedReferrer'? Thanks in advance.
9
14404
by: Frances Del Rio | last post by:
if I put alert(document.referrer) in code of a file that was linked from another it returns blank... pls, need to get document.referrer, don't why it's not working... read up on oreilly, don't know what I'm doing wrong.. thank you.. Frances
2
2370
by: Goober | last post by:
I have to determine the document.referrer of the individual coming to my site. I want to send everyone not coming from one of those sites to an alternate location (The names below are just used as examples). I want to match on one of those names anywhere in the document.referrer. In the main program I call a subroutine like this: <script LANGUAGE="javascript" SRC="../js/redirect.js"></script> <body leftmargin="0" rightmargin="0"...
2
10276
by: X l e c t r i c | last post by:
Hi, I'm trying to put the last URL visited to a text input using history.previous for WebTV (because I can't get document.referrer to work with WebTV) and document.referrer for PC. This is for my Web Resources page. Where if I go straight to it from an image that I want to edit with an online imaging tool, or if I go straight to it from a page that I want to validate, I can put the URL to the text input of the portal I want to use.
1
2766
by: Mike Dee | last post by:
Hi All - I'm having a strange problem I'm wondering if anyone can shed some light on. When I use ASP or ASP.NET code to get the referrer information from the server side, it comes back as null. However in these same cases document.referrer returns the valid referrer. What could cause this? In other words, with the following line: ref = Request.ServerVariables("HTTP_REFERER") (or its ASP.NET equivalent)
5
11011
by: Nospam | last post by:
does anyone know if there is anything wrong with this code? <SCRIPT LANGUAGE="JavaScript">document.referrer.indexOf("http://www.example.com") != -1){ document.write("http://www.example.com/image1.jpg")} </SCRIPT> ?
0
8435
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8768
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4348
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1754
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.