本文介绍了JavaScript函数拒绝在生产服务器上运行,但在本地服务器上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用从Macromedia Dreamweaver借来的MM_goToURL()函数将HTTP请求发送到服务器上的特定URL.下面是该函数的代码,它在外部JavaScript文件中声明.

I am using the MM_goToURL() function which I borrowed from Macromedia Dreamweaver to send HTTP requests to specific URLs on the server. Below is the code for the function, it is declared in an external JavaScript file.

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments;document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

我有一个选择组合框,该组合框应该在更改时触发请求.这是下面代码的静态形式.请注意,它通常是使用JSP动态生成的.

I have a select combobox that is supposed to trigger the requests when it is changed.Here is the static form of the code below. Note that it usually generated dynamically using JSP.

<!-- The next line of code is where the problem is -->
<select onchange="MM_goToURL('parent','statistics_servlet.mpcs?chart=Sales&chartType=Daily&weekSelected='+this.value);">
       <option value="Jan 5, 2014" selected="selected">This week: Jan 5, 2014 to Jan 11, 2014</option>
       <option value="Dec 29, 2013">Last week: Dec 29, 2013 to Jan 4, 2014</option>
       <option value="Dec 22, 2013">Prev week: Dec 22, 2013 to Dec 28, 2013</option>
       <option value="Dec 15, 2013">Prev week: Dec 15, 2013 to Dec 21, 2013</option>
                     ...
                     ...
       <option value="Nov 10, 2013">Prev week: Nov 10, 2013 to Nov 16, 2013</option>
       <option value="Nov 3, 2013">Prev week: Nov 3, 2013 to Nov 9, 2013</option>
</select>

上面的代码在localhost服务器上运行良好,但在我的生产服务器/域上不工作.

The code above works perfectly well on localhost server, but does not work on my production server/domain.

我的域名是" www.royalseeds.org ",但它设置为转发&屏蔽到生产服务器,网址为 http://idy777.s156.eatj.com/RoyalSeedsMPCS/

My domain name is "www.royalseeds.org" but it is set to forwarding & masking to the production server at http://idy777.s156.eatj.com/RoyalSeedsMPCS/

由于域名更友好,我的用户将不得不使用域名而不是服务器URL.所涉及页面的URL是 http://www.royalseeds.org/statistics_servlet.mpcs,但是组合框在更改后拒绝发送请求.

My users will have to use the domain name instead of the server URL since the domain name is more friendly. The URL to the page that is in question is http://www.royalseeds.org/statistics_servlet.mpcs but the combobox refuses to send the request when changed.

显然这不是Servlet/JSP问题,我怀疑是域名转发/屏蔽机制.

Obviously this isn't a Servlet/JSP problem, my suspicion goes to the domain name fowarding/masking mechanism.

我还使用此URL http://idy777.s156.eatj测试了该页面. com/RoyalSeedsMPCS/statistics_servlet.mpcs ,它像我的

I also tested the page with this URL http://idy777.s156.eatj.com/RoyalSeedsMPCS/statistics_servlet.mpcs and it works perfectly well like my

http://localhost:8080/RoyalSeedsMPCS/statistics_servlet.mpcs

所以,我的问题是:我该怎么做才能解决这个问题?

修改:我已禁用了 http://idy777.s156的指定页面/servlet的过滤器. eatj.com/RoyalSeedsMPCS/statistics_servlet.mpcs http://www.royalseeds.org/statistics_servlet .mpcs ,以便启用对该页面的访问.但是出于安全原因,我会在24小时后启用它.谢谢.

I have disabled the filters for the specified page/servlet which is http://idy777.s156.eatj.com/RoyalSeedsMPCS/statistics_servlet.mpcs or http://www.royalseeds.org/statistics_servlet.mpcs so to enable access to the page. But I will enable it after 24 hours for security reasons. Thanks.

推荐答案

我已经进行了一些研究,我发现域名转发和屏蔽会导致该网站位于html框架中,从而使JavaScript链接无法正常工作.

I have done some research, I figured that the domain name forwarding and masking causes the site to be in a html frame, thereby disabling the JavaScript link from working.

这是我的域名上的托管站点的源代码:

This is the source code to the hosted site on my domain name:

 <html>

  <head>
   <title>Royalseeds </title>
   <META name="description" content="Royalseeds MPCS Limited"><META name="keywords" content="Royalseeds, Frozen Foods, Cool Room">
  </head>
   <frameset rows="100%,*" border="0">
    <frame src="http://www.optdesolver.com/RoyalSeedsMPCS/statistics_servlet.mpcs" frameborder="0" />
    <frame frameborder="0" noresize />
   </frameset>

   <!-- pageok -->
    <!-- 03 -->
    <!-- -->
 </html>

上面的代码可防止JavaScript加载.

The code above prevents the JavaScript from loading.

解决方案::我将禁用屏蔽功能,但允许转发.

Solution: I will disable the masking but allow forwarding.

这篇关于JavaScript函数拒绝在生产服务器上运行,但在本地服务器上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 23:11