简体   繁体   English

Drupal 6.16的链接问题

[英]Link problem with Drupal 6.16

i am currently working on a website and I need to make a chat application for it (as seen on some other questions i posted, haha) 我目前在一个网站上工作,我需要为此创建一个聊天应用程序(如我在其他一些问题上看到的,哈哈)

Anyway, the gist is that I now have my website (on localhost for the time being), and my chat application. 无论如何,要点是,我现在有自己的网站(暂时在localhost上)和聊天应用程序。 Now i need to make a button which, on click, will open the chat webpage in a pop-up window. 现在,我需要单击一个按钮,将在弹出窗口中打开聊天页面。 I can do this easily with the following code: 我可以使用以下代码轻松完成此操作:

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function AlertCC()
{
window.open("http://localhost/chat/node/1", "MyWindow", "height=520,width=560,scrollbars=no"); 
}
</SCRIPT>
</HEAD>
<BODY>
<CENTER><FORM><INPUT TYPE="BUTTON" VALUE="Open Chat Room" onClick="AlertCC()"></FORM></CENTER><p>

My problem is in the part of the: 我的问题在于:

window.open("http://localhost/chat/node/1", "MyWindow", "height=520,width=560,scrollbars=no");

wherein when I click the button, the page http://localhost/chat/node/1 will be opened in a pop-up window. 其中,当我单击按钮时,将在弹出窗口中打开页面http:// localhost / chat / node / 1 This works well IN MY MACHINE with my localhost. 这在我的本地主机上的“我的机器”中运行良好。 However, whenever I run this on some other computer on the network through localhost, it opens the pop-up window (as expected) and does not navigate to the url. 但是,每当我通过localhost在网络上的其他计算机上运行此命令时,它都会打开弹出窗口(如预期的那样),并且不会导航到url。 Based on some investigations I did, it basically looks for the native localhost (the localhost of the computer) and not into my localhost where the core files are located. 根据我所做的调查,它基本上是在寻找本机本地主机(计算机的本地主机),而不是核心文件所在的本地主机。 I have options of changing my pop-up window opener code but I can't seem to find any other options than this one. 我可以选择更改弹出窗口打开器代码,但是除了该选项外,我似乎找不到其他任何选项。

Can anybody please tell me how I will be able to fix this? 有人可以告诉我如何解决此问题吗? Thanks a lot :) 非常感谢 :)

If you want to let others test on your machine, you need to either change the link, so it points to your machine (IP), or use the vhost file on their machines to let localhost point to your machine. 如果要让其他人在您的计算机上进行测试,则需要更改链接,使其指向您的计算机(IP),或者使用其计算机上的vhost文件让localhost指向您的计算机。

Debugging these kinds of problems, is best done on a dev / staging server though. 调试此类问题最好在开发/登台服务器上完成。

Why not just 为什么不只是

window.open("http://www.domain.com/chat/node/1"

On your machine, make a hosts file entry for www.domain.com with your IP (or server environment IP) on your network. 在计算机上,使用网络上的IP(或服务器环境IP)为www.domain.com创建主机文件条目。 Should work. 应该管用。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM