Page prevented for being displayed when using javascript

S

schitroc

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
 
T

Thomas 'PointedEars' Lahn

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">
<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
 
S

schitroc

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top