0

Scenario: Script to detect phone numbers on a given web page and highlight the phone numbers by an anchor tag.The script runs well in FF and Chrome, but fails in IE9 by throwing SCRIPT5: Access denied error.

I have gone through other posts, hoping that it would solve my problem , but in vain.

Below is my code:

var regex = /\+?\d{1,4}?[-.\s]?\(?\d{1,3}?\)?[-.\s]?\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,9}/g;
jQuery.fn.linker = function () {
                        $(this).contents()
                               .filter(function(){return this.nodeType !== 3;})
                               .each(function(){$(this).linker();});



                        $(this).contents()
                               .filter(function() { return this.nodeType === 3; })
                               .each(function () {
                                    $(this).replaceWith(
                                    $(this).text().replace(regex,"<a href=\"javascript:;\">$&</a>"));});



                };
                $(document).ready(function () {
                    $('body').linker();
                    $( 'a' ).click( function () {
                        var href = $(this).text();
                        var tel = regex.test(href);
                        if ( tel ) {
                                //alert( 'A telephone link was clicked: ');
                                href = href.replace(/[(]\d[)]|[.-]/g,'');
                                //launchwebDialerServlet(href);
                                //alert(href);
                                //event.preventDefault();
                                //window.open($(this).attr('href'),"popupWindow","width=600,height=600,scrollbars=yes");
                         }
                    });
                });

Below is the screenshot of the error enter image description here I hope,my question is clear.

logan
  • 110
  • 11
  • It looks like the error has to do with your code attempting to access the contents of an ` – Pointy Jun 23 '14 at 13:44
  • @Pointy When i select `` it throws ` – logan Jun 25 '14 at 09:26
  • I don't know what exactly the security situation is; IE may be more strict than Firefox and Chrome. It depends on what exact URL is loaded in the ` – Pointy Jun 25 '14 at 12:16

0 Answers0