2013-06-18 2 views
0

"http://www.google.com"인 URL에 string.fromcharcode를 사용하는 데 문제가 있습니다.string.fromcharcode javascript not working

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

는 내가하려고하면 :

<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)"> 

그것은 작동하지 않습니다. // 편집 그렇다면 string.fromcharcode를 사용할 수 없다면 내 URL을 인코딩 할 수있는 다른 방법은 없을까요?

+1

'content' 태그에 javascript를 넣을 수 없습니다. –

+0

[잘 작동합니다] (http://jsfiddle.net/apPX3/) - 문제가 다른 곳에서 발생했습니다 – musefan

+0

JavaScript 코드를 덤프하면 실행됩니다. – Jon

답변

1

이 태그는 자바 스크립트이므로 script 태그에 속합니다. 참조 : String.fromCharCode() 예 :

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

아마도 다른 웹 사이트를 언급 할 때 location.href을 사용하고 싶을 것입니다.