Jump to content

goTo url problem


Dark Knight
 Share

Recommended Posts

I have a problem with this script:<script language="JavaScript"><!-- var originalURL = document.referrer||'Referrer unknown'function goTo(url){ location.href = url+'?'+ escape(originalURL);}//--></script>This script allow to navigate to a page using:<a href="java script:;" onclick="goTo('history.html');return false">History</a>The problem is thath it dosen't go to that page and still the page exists. any reasons? tnx.

Link to comment
Share on other sites

This isn't doing what you think it is:var originalURL = document.referrer||'Referrer unknown'That is a boolean OR operator, so originalURL is equal to document.referrer OR 'Referrer unknown'. The value of the expression "document.referrer OR <string>" is probably going to be the value "true". It's either going to be true or false. Print originalURL to see what it gets set to.

Link to comment
Share on other sites

That last | should be a :
I've tryed to replace the last "|" with a : but appearce a error and dosen't work. If the problem can't be solved than can you show me a script that can go to a page like this: <a href="java script:;" onclick="GO TO URL">Page</a>
Link to comment
Share on other sites

I've tried you're code but it's a problem on the pagelook at this page Visit My Website go to the LICEUL NOSTRU menu and hit the Galerie Foto submenu. Then look at the address bar and it looks like this: http://www.darkknight.3x.ro/sitenou/galeri...enou/index.html WHY?"????

Link to comment
Share on other sites

Okey, I understand now. I've removed var originalURL = document.referrer||'Referrer unknown' and +'?'+ escape(originalURL);. Now the script looks like: function goTo(url){location.href = url;}. Thank you for you're help :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...