简体   繁体   English

JavaScript函数拒绝在生产服务器上运行,但在本地服务器上运行

[英]JavaScript function refuses to work on production server but works on local server

I am using the MM_goToURL() function which I borrowed from Macromedia Dreamweaver to send HTTP requests to specific URLs on the server. 我正在使用从Macromedia Dreamweaver借来的MM_goToURL()函数将HTTP请求发送到服务器上的特定URL。 Below is the code for the function, it is declared in an external JavaScript file. 下面是该函数的代码,它在外部JavaScript文件中声明。

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]+"'");
}

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. 注意,它通常是使用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>

The code above works perfectly well on localhost server, but does not work on my production server/domain. 上面的代码在localhost服务器上运行良好,但在我的生产服务器/域上不起作用。

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/ 我的域名是“ www.royalseeds.org ”,但是它设置为转发和屏蔽到生产服务器, 网址http://idy777.s156.eatj.com/RoyalSeedsMPCS/

My users will have to use the domain name instead of the server URL since the domain name is more friendly. 由于域名更友好,我的用户将不得不使用域名而不是服务器URL。 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. 有问题的页面的URL是http://www.royalseeds.org/statistics_servlet.mpcs,但是组合框在更改后拒绝发送请求。

Obviously this isn't a Servlet/JSP problem, my suspicion goes to the domain name fowarding/masking mechanism. 显然这不是Servlet / JSP问题,我怀疑是域名转发/屏蔽机制。

I also tested the page with this URL http://idy777.s156.eatj.com/RoyalSeedsMPCS/statistics_servlet.mpcs and it works perfectly well like my 我还使用此URL http://idy777.s156.eatj.com/RoyalSeedsMPCS/statistics_servlet.mpcs测试了该页面,它的工作原理与

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

So, my question is: what can I do to solve this problem? 所以,我的问题是:我该怎么做才能解决这个问题?

Edit: 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. 编辑:我已禁用指定页面/ servlet的过滤器,该页面是http://idy777.s156.eatj.com/RoyalSeedsMPCS/statistics_servlet.mpcshttp://www.royalseeds.org/statistics_servlet.mpcs以便启用访问权限到页面。 But I will enable it after 24 hours for security reasons. 但是出于安全原因,我会在24小时后启用它。 Thanks. 谢谢。

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. 我进行了一些研究,发现域名转发和屏蔽导致站点位于html框架中,从而使JavaScript链接无法正常工作。

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>

The code above prevents the JavaScript from loading. 上面的代码可防止JavaScript加载。

Solution: I will disable the masking but allow forwarding. 解决方案:我将禁用屏蔽,但允许转发。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Javascript函数可在本地服务器上运行,但不能在线运行 - Javascript Function Works on Local Server but not Online Javascript可在本地服务器上运行,但不能在实时服务器上运行 - Javascript works on local server but not on live server JSP / Javascript文件上传-在托管服务器上不调用父级javascript函数,但在本地服务器上有效 - JSP/Javascript file upload - doesn't invoke a parent javascript function on hosting server but works in local server 按需Javascript在生产服务器上不起作用 - Javascript on demand doesn't work on production server $ routeProvider不在生产服务器上路由,但在本地计算机上工作 - $routeProvider does not route on production server, but works on local machine 当我在生产环境中推送但不在本地服务器上推送时,datetimepicker起作用[ROR 4] - Datetimepicker works when I pushed on production but not on local server [ROR 4] javascript elasticsearch-在本地实例上可用,但在服务器上不可用? - javascript elasticsearch - works on local instance but not on server? Jquery 函数适用于本地服务器但不适用于 Live? - Jquery Function works on Local Server but not on Live? jQuery Ajax在本地主机上工作,但拒绝在服务器上工作 - Jquery Ajax working on localhost but refuses to work on server 功能在生产服务器上不在Code Playground中按预期方式工作。 - Function works as expected in Code Playground not on production server.
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM