1

I'm having a very strange issue on IE8 (and only on IE version lower than 8). The problem is in attr binding, if I put encoded email string (with %26, %40 and etc.) the page won't render the data binds in text field ('[email protected]' in the case below), instead it will render as "mailto:first%26last%40domain.com".

<a data-bind="    visible: Email.length > 0, text: '[email protected]', attr:{ href: 'mailto:' +  'first%26last%40domain.com' }"></a>

The strange thing is it renders just fine if I use the non-encoded string

<a data-bind="    visible: Email.length > 0, text: '[email protected]', attr:{ href: 'mailto:' +  'first&[email protected]' }"></a>

Both ways work properly on Firefox and Chrome and higher version IE.

1
  • Probably just an IE8 bug, maybe only for locally hosted: wrensoft.com/forum/… Commented Jul 30, 2015 at 1:20

1 Answer 1

1

I debugged through it and found Knockout js is using the DOM method setAttribute() to set href. And per the documentation from W3School, setAttribute() supports browser IE9 and newer, so I think that is what causes the strange result.

I also searched around about the setAttribute(), other people also encountered similar issue, see link below:

https://social.msdn.microsoft.com/Forums/ie/en-US/aa6bf9a5-0c0b-4a02-a115-c5b85783ca8c/javascript-modifying-href-changes-link-text-as-well-for-mailto-protocol?forum=iewebdevelopment

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.