0

I'm having trouble using string.fromcharcode on my url which is "http://www.google.com".

<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.google.com">

If i try:

<meta HTTP-EQUIV="REFRESH" content="0; url=String.fromCharCode(104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 103, 111, 111, 103, 108, 101, 46, 99, 111, 109)">

It doesn't work. //Edit Then if i can't use string.fromcharcode what else can i do to encode my url?

  • 1
    You can't put javascript in the `content` tag like that. – Adam Hopkinson Jun 18 '13 at 16:05
  • [Works fine here](http://jsfiddle.net/apPX3/) - your problem is somewhere else – musefan Jun 18 '13 at 16:05
  • What makes you thing that if you dump JavaScript code in there it will be executed? – Jon Jun 18 '13 at 16:05
  • 1
    Probably won't work even if attempted properly; possible duplicate of [Changing the content of meta refresh does not change refreshing time](http://stackoverflow.com/questions/14790065/changing-the-content-of-meta-refresh-does-not-change-refreshing-time) – Alex K. Jun 18 '13 at 16:07
  • 2
    As an aside, this is the kind of code I *hate*. An instant redirect to a url that is obfuscated? What are you trying to do here, and why are you trying to hide it. Create something people want to use. – Adam Hopkinson Jun 18 '13 at 16:09
  • Adam, i'm having trouble using http: or //, it gets formatted as a url, so i need to obfuscate it to avoid that. – user2489256 Jun 18 '13 at 16:09
  • It *is* a url - why is that a problem? – Adam Hopkinson Jun 18 '13 at 16:10
  • You don't understand, because it gets formatted as a url, it does not execute, instead it remains visual. – user2489256 Jun 18 '13 at 16:11
  • 1
    It sounds like you're putting this in the `body` of the page - it needs to go in the `head`. Then it will execute and you won't need to obfuscate it. – Adam Hopkinson Jun 18 '13 at 16:12
  • Your behaviour towards those trying to help you is not welcome here. **EDIT** @user2489256 wrote a *very* abusive comment towards me, and has now removed it. – Adam Hopkinson Jun 18 '13 at 16:27

1 Answers1

1

This belongs in a script-tag, since it is Javascript. Reference: String.fromCharCode() e.g.

<script type='text/javascript'>
    string=String.fromCharCode(65,72,65)
    console.log(string)
</script>

Perhaps you want to use location.href to refer to another website.

Thomas Junk
  • 5,588
  • 2
  • 30
  • 43