Page prevented for being displayed when using javascript

Discussion in 'Javascript' started by schitroc@gmail.com, Apr 30, 2009.

  1. Guest

    Hi all,

    1) My web server is behind a firewall, and some users are using the
    following setup to access it:
    <input type="button" value="Continue" onClick="javascript:goToMyCompany
    ('')";/>
    <script language="javascript">
    function goToMyCompany()
    {
    location.href="http://myserver.com";
    }
    </script>

    They are getting the 'Problems with this web page might prevent it
    from being displayed properly' error messages.

    2) This is javascript that I am using and this is the error that the
    user is getting on his browser: 'Error:
    somefile.serviceObj.lastservice' is null or not object.

    <script type="text/javascript" src="/Resources/stdheaders.js"></
    script><script type="text/javascript" src="/Resources/somefile.js"></
    script>
    <script type="text/javascript">
    somefile.pageCount=somefile.pageCount||0;
    somefile.pageCount++;
    somefile.serviceObj={lastservice:"",nowservice:"",userid:""}

    somefile.serviceObj.lastservice = lastservice;
    </script>
    The above code works properly when the user is behind the firewall or
    the user is outside of the firewall and uses the straigth URL:
    http://myserver.com instead of the setup file from point 1. Hint: this
    error appeared after I installed a fix for IE Cross-frame scripting
    fix.

    Any help is welcomed.

    Thanks,
    Silvio
     
    , Apr 30, 2009
    #1
    1. Advertising

  2. wrote:
    > 1) My web server is behind a firewall, and some users are using the
    > following setup to access it:
    > <input type="button" value="Continue" onClick="javascript:goToMyCompany
    > ('')";/>


    This can not be Valid markup. If it was HTML, you would need to lose the
    `/'; if it was XHTML, which requires the `/' but is case-sensitive, you
    would need to use `onclick' instead. Given little support for XHTML at this
    point, you should only declare and use HTML 4.01 unless XHTML is absolutely
    necessary.

    See <http://validator.w3.org/>

    And lose the `javascript:'. In fact, you don't need any scripting here:

    <form action="http://myserver.com/">
    <input type="submit" value="Continue">
    </form>

    > <script language="javascript">


    <script type="text/javascript">

    since almost 10 years now. See above.

    > function goToMyCompany()
    > {
    > location.href="http://myserver.com";
    > }
    > </script>
    >
    > They are getting the 'Problems with this web page might prevent it
    > from being displayed properly' error messages.


    The code above is unrelated to your problem and to the error message. A
    plain URL like this is by no means a way to get through a firewall. (Do you
    even know what a firewall really is?)

    > 2) This is javascript that I am using and this is the error that the
    > user is getting on his browser: 'Error:
    > somefile.serviceObj.lastservice' is null or not object.
    >
    > <script type="text/javascript" src="/Resources/stdheaders.js"></


    Avoid capital letters in resource names. Especially, consider
    case-sensitive server file systems.

    > script><script type="text/javascript" src="/Resources/somefile.js"></
    > script>
    > <script type="text/javascript">
    > somefile.pageCount=somefile.pageCount||0;
    > somefile.pageCount++;


    The following is equivalent and more efficient:

    if (!somefile.pageCount)
    {
    someFile.pageCount = 1;
    }
    else
    {
    someFile.pageCount++;
    }

    > somefile.serviceObj={lastservice:"",nowservice:"",userid:""}
    >
    > somefile.serviceObj.lastservice = lastservice;


    The following is equivalent and more efficient:

    somefile.serviceObj = {
    lastservice: lastservice,
    nowservice: "",
    userid: ""
    };

    > </script>
    > The above code works properly when the user is behind the firewall or
    > the user is outside of the firewall and uses the straigth URL:
    > http://myserver.com instead of the setup file from point 1.


    I seriously doubt that your firewall has anything to do with it.
    Client-side redirection with (window.)location to somewhere works
    everywhere (where (window.)location is supported).

    > Hint: this error appeared after I installed a fix for IE Cross-frame
    > scripting fix.


    A fix for a fix? And which one anyway?

    > Any help is welcomed.


    Unfortunately, you forgot to post the relevant snippet of somefile.js where
    supposedly `somefile' is initialized. It is that initialization which is
    successful but appears to assign a reference to a host object that does not
    allow augmentation of it with a `serviceObj' property, or assignment of an
    Object object reference to its existing `serviceObj' property.

    Please read and take heed of <http://jibbering.com/faq/#posting> pp.


    PointedEars
     
    Thomas 'PointedEars' Lahn, Apr 30, 2009
    #2
    1. Advertising

  3. Guest

    Thomas,

    These are the clarifications you asked:

    1) I used the sessvars object to store user_id between several web
    pages.
    It worked like a charm until one of my clients used this page to
    point to my web site:
    <input type="button" value="Continue" onClick="javascript:goToMyServer
    ('')";/>
    <script language="javascript">
    function goToMyServer(
    {
    location.HREF="http://myserver.com";
    }
    </script>
    Now the user is getting errors that the sessvar.serviceObj.lastservice
    is null or not an object.
    2) This is how I defined my sessvar object:
    <script type="text/javascript" <script type="text/javascript" src="/
    Resources/sessvars.js">
    </script><script type="text/javascript">
    sessvars.pageCount=sessvars.pageCount||0;
    sessvars.pageCount++;
    sessvars.serviceObj={lastservice:"",nowservice:"",userid:""}
    </script>

    3) This is where the error (sessvar.serviceObj.lastservice
    is null or not an object) is generated (inside the javascript
    section):
    sessvars.serviceObj.nowservice = nowservice;
    sessvars.serviceObj.lastservice = lastservice;

    4) sessvars.js content:see this link: http://www.thomasfrank.se/sessionvars..html#comment104

    Thanks,
    Silvio



    On Apr 30, 4:08 pm, wrote:
    > Hi all,
    >
    > 1) My web server is behind a firewall, and some users are using the
    > following setup to access it:
    > <input type="button" value="Continue" onClick="javascript:goToMyCompany
    > ('')";/>
    > <script language="javascript">
    > function goToMyCompany()
    > {
    >    location.href="http://myserver.com";}
    >
    > </script>
    >
    > They are getting the 'Problems with this web page might prevent it
    > from being displayed properly' error messages.
    >
    > 2) This is javascript that I am using and this is the error that the
    > user is getting on his browser: 'Error:
    > somefile.serviceObj.lastservice' is null or not object.
    >
    > <script type="text/javascript" src="/Resources/stdheaders.js"></
    > script><script type="text/javascript" src="/Resources/somefile.js"></
    > script>
    > <script type="text/javascript">
    > somefile.pageCount=somefile.pageCount||0;
    > somefile.pageCount++;
    > somefile.serviceObj={lastservice:"",nowservice:"",userid:""}
    >
    > somefile.serviceObj.lastservice = lastservice;
    > </script>
    > The above code works properly when the user is behind the firewall or
    > the user is outside of the firewall and uses the straigth URL:http://myserver.cominstead of the setup file from point 1. Hint: this
    > error appeared after I installed a fix for IE Cross-frame scripting
    > fix.
    >
    > Any help is welcomed.
    >
    > Thanks,
    > Silvio
     
    , Apr 30, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike H
    Replies:
    1
    Views:
    743
    Chris Smith
    Feb 27, 2004
  2. Al Hatch
    Replies:
    3
    Views:
    468
    Martin Honnen
    Jun 4, 2006
  3. Replies:
    0
    Views:
    728
  4. Replies:
    0
    Views:
    669
  5. AAaron123
    Replies:
    6
    Views:
    428
    AAaron123
    Nov 8, 2008
Loading...

Share This Page