访问远程jQuery文件 [英] Access remote jQuery file

查看:173
本文介绍了访问远程jQuery文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个网站(只有3个成员才能访问)。我需要在该网站上安装jQuery。因为它是一个网站,其成员非常有限,所以我决定将jQuery文件放在每台PC的C盘中,并决定链接到它,以减少页面加载时间。但是,链接不起作用。
以下是我的代码: -

 <!DOCTYPE html> 
< html>
< script src =file:/// C:/jquery.min.js>< / script>
< script>
$(document).ready(function(){
$(body)。html(Replaced text);
});
< / script>
< body>

将此文本替换为
< / body>

无法获取远程jQuery文件?



解决方案

首先,您不能通过这种方式访问​​用户的本地文件。这将是一个巨大的安全例外。只有一种方式可以访问用户的文件,即当用户自愿上传文件时。




现在,为您提供解决方案,如果您只有3-4名成员且他们不可变,那么您必须尝试使用​​本地服务器。 为什么要离线访问网页?

使用本地服务器可以为你节省带宽和页面将会非常快速地加载。然后 YES ,您可以将jquery文件存储在本地计算机上的项目文件夹中。

对于初学者, WAMP SERVER XAMPP SERVER 可以证明成为一个福音。它们包含在mysql,php和管理功能中。这必须完全符合你的要求。 b $ b $ Furthur评论:如果用户连接到局域网(我想你的情况),你可以在一台机器上安装WAMP或XAMPP并使用它IP服务器机器的地址。例如 - > 192.168.1.2/YOUR_APP / ,并在服务器机器上以 localhost / YOUR_APP


I am building a website (to be accessed by only 3 members). I need to install jQuery in that website. Since, it is a website with very limited members, I decided to have the jQuery file in the C drive of every PC and decided to link to it instead so that the page load time is decreased. But, the link is not working. The following is my code:-

<!DOCTYPE html>
<html>
<script src="file:///C:/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("body").html("Replaced text");
});
</script>
<body>

Replace this text
</body>

Is it not possible to fetch the remote jQuery file?

解决方案

First of all, there is no such way by which you can access a user's local file. This will be a huge security exception. There is only one way by which you can access a user's file, i.e. when the user uploads the files voluntarily.


Now, offering you a solution, if you have only 3-4 members and they are not variable, then you must try using a local server. Why access the web pages online when you can access them offline?

Using a local server may save you bandwith as well as pages will load immensely fast. And then YES you can store the jquery file in your project folder which is in the local machine.


For starters, WAMP SERVER and XAMPP SERVER can prove to be a boon. They are included with mysql, php and administrating features. This must be exactly what you are looking for.
Furthur comments : If the users are connected with LAN (which I guess in your case), you can install WAMP or XAMPP in only one machine and access it using the I.P. address of the server machine. For eg -> 192.168.1.2/YOUR_APP/ and access it in the server machine as localhost/YOUR_APP

这篇关于访问远程jQuery文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆