18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

document.write for javascript returns error on IE8

briagnbriagn Members
edited April 2011 in Sahi - Open Source
Hi,

I have been getting an error from IE8 saying "Syntax error". I do not see this when viewing the page without using sahi or viewing any other pages that don't have the following document.write javascript statement with sahi. This problem appears for both http and https url in the address bar. This issue makes testing become more time consuming as we have to click for the details of the error every time to make sure there is no real or new errors introduced. Is there a way to at least suppress this error? Any help would be greatly appreciated!

Sorry, I had to replace the . with (dot) so that I can post the message.

Thanks!

On https: // www(dot)myintranet(dot)com/ (using host file)
=============================================

<html>
...
...
<script type="text/javascript">document.write('<s'+'cript language="JavaScript" src="https: // xxxxxx(dot)xxxxxxx(dot)com/xxxxxx"></s'+'cript>');</script>
...
...
</html>


IE 8 Error Returns
================

Errors on this webpage might cause it to work incorrectly

Message: Syntax error
Line: 2
Char: 1
Code: 0
URI: https: // xxxxxx(dot)xxxxxxx(dot)com/xxxxxx

Comments

  • narayannarayan Administrators
    Hi briagn,

    It looks like some problem in the content-type of the JS file, and Sahi is injecting code into it.

    Add
    https://xxxxxx[.]xxxxxxx[.]com/xxxxxx
    to sahi/userdata/config/exclude_inject.txt,
    Restart Sahi, and check.

    You can also disable the error popup by unchecking
    IE -> Tools/Gear Icon -> Internet Options -> Advanced (Tab) -> Uncheck "Display a notification about every script error"

    Restart IE and the alerts should go away.

    Regards,
    Narayan
  • briagnbriagn Members
    Hi narayan,

    Thanks so much for your quick reply. It works!

    I guess I did tried putting in the url in the exclude_inject.txt earlier through the Sahi Dashboard's Configuration, but probably I never restarted the Dashboard and the setting didn't got kicked in. Now, everything is running smoothly.

    Thanks a lot for your help on this awesome application!! :)
  • narayannarayan Administrators
    Thanks!
This discussion has been closed.