3

I need to know what characters are considered valid (in a cross-browser way) for window.name in javascript.

t33st33r
  • 197
  • 2
  • 9
  • 1
    Is there some reason that you think it is more limited than any typical Javascript string which is basically anything that fits into a unicode string? – jfriend00 Sep 23 '15 at 23:13
  • I have no reason, i am asking for caution. – t33st33r Sep 23 '15 at 23:17
  • 1
    I have found this: https://www.ibm.com/developerworks/community/blogs/hazem/entry/window_open_invalid_argument_in_ie2 – t33st33r Sep 23 '15 at 23:27
  • @jfriend00: it is different than a typical string, for example the string coercion if setting it to a number and the after-reload persistence... As a computed property, it should conform to DOMString. – dandavis Sep 24 '15 at 00:00

1 Answers1

0

window.name contains data that is in the format of a string. That being said, it can have any value that is valid in a JS string.

  • Valid Text (Numbers, Letters, some special characters)
  • Anything that is valid after being escaped (\n, \\, \r, \., \+, \?) etc. You can look at JS characters that need to be escaped here. There is also more information at this website.
Community
  • 1
  • 1
intboolstring
  • 6,891
  • 5
  • 30
  • 44
  • It is not a function... you can set its value in Internet Explorer or Firefox... can someone confirms me if it is read-write on other browsers? please. – t33st33r Sep 23 '15 at 23:10
  • Sorry, you are right, it is a value. I accidentally put the parenthesis at the end. – intboolstring Sep 23 '15 at 23:11
  • Can you cite a source that clearly specifies what is allowed? In my experience, and this may be limited to older browsers, there were limits, especially in the use of spaces or punctuation, and there are length limits. I created utility functions so an app can use whatever names they want, where the the functions escaped the names to ensure they worked as expected. – ewh Mar 14 '16 at 19:24