仅使用普通编码即可创建功能齐全的网站

发布于 2024-11-07 18:02:11 字数 358 浏览 3 评论 0原文

当我说“普通编码”时,我指的是不使用服务器端编码(例如 PHP、ASP 等)、仅使用 HTML、JavaScript 和 CSS 的网站。

我知道已经存在大量网站,它们没有使用(据我所知)许多其他网站使用的任何常见服务器端语言(PHP、ASP 等),但仍然运行良好!

我很困惑!这些网站如何在不使用服务器端脚本语言的情况下继续保存登录信息、保留记录等?我有什么遗漏的吗? JavaScript 是否可以访问比我想象的更多的内容(例如数据库和本地文件)?

编辑

事实证明,我犯了一个严重而可耻的错误,认为仅仅因为它以 .html 扩展名结尾,它只是客户端。不过没关系,因为我正在学习。非常感谢大家的帮助!

When I say "Vanilla Coding", I am referring to websites that don't utilize server side coding (such as PHP, ASP, etc.), only HTML, JavaScript, and CSS.

I know that there are a plethora of sites that already exist that don't utilize (to my knowledge) any of the common, server side languages used by many others (PHP, ASP, etc.), but still function just fine!

I am confused! How do these sites continue to save login information, keep records, etc. etc. without using a server side scripting language? Is there something that I am missing? Can JavaScript access more (such as databases and local files) than what I thought it could?

EDIT

Turns out I've made a serious and shameful mistake in assuming that just because it ended with a .html extension that it was client-side only. That is okay though because I'm learning. Thanks so much for the help everybody!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

触ぅ动初心 2024-11-14 18:02:12

没有客户端脚本可以访问服务器端信息(如数据库),而无需某种服务器端通信(通过 ajax 等)

如果您真的(我的意思是真的不要这样做)想要登录并且就像在客户端一样,您必须制作某种存储在用户计算机上的 cookie,还需要一个用户列表(任何人都可以读取)来使用

No client side script can access server side information (like a database) without some sort of server side communication (through something like ajax or the like)

If you really ( i mean really as in don't do it ) want to do logins and the like on clients side, you would have to make some sort of cookie that you store on the user's computer, also you would need a list of users (which anyone can read) to use against

泛滥成性 2024-11-14 18:02:12

这个答案很晚了,但我把这个答案留给任何可能偶然发现它的人。

使用 javascript/jQuery 和各种 API,只需使用客户端编码即可创建一个简单的站点。

例如,可以创建一个简单的购物车类型的网站。我以前做过。

很少有(不是很多)严格 100% 基于 jQuery 的开源购物车解决方案。

PG(支付网关)如何处理?您只能通过 PayPal、Google Checkout 和直接存款接受付款。

允许客户发表评论怎么样?您可以使用 Disqus 等 API。聊天支持怎么样?佐平非常方便。

购买后如何收到通知?贝宝和谷歌结账会通知您。

群发电子邮件怎么样?邮件黑猩猩。

就我个人而言,我几乎总是使用 WordPress 或其他一些类型的 CMS,但仅使用普通编码来构建简单的网站不仅可行,而且在某些情况下非常明智。

This answer is very late but I leave this reply for anyone who may stumble upon it.

Using javascript/jQuery, and various APIs a simple site can be created only using client-side coding.

For instance, a simple shopping cart type of site can be created. I've done it before.

There are few (not many) strictly 100% jQuery based shopping cart solutions that are open-source.

How does the PG (pay gateway) get taken care of? You are limited to accepting payment through paypal, google checkout, and direct deposit.

What about allowing customers to leave comment? You can use API's like Disqus. What about chat support? Zopim is pretty handy.

How do you get notified when purchase is made? Paypal & google checkout notifies you.

What about sending mass email? Mail Chimp.

Personally, I almost always use WordPress or some other types of CMS but using only vanilla coding to build a simple site is not only feasible but very sensible in certain circumstances.

梦里人 2024-11-14 18:02:12

除非网站允许您查看文件扩展名,否则您不会看到网站是否使用服务器端语言。通过 URL 重写、MVC 模式等,很容易隐藏甚至伪造该信息。因此,您认为不使用服务器端语言的站点很可能实际上正在使用服务器端语言。

现在,站点可以在 cookie 中保存某些信息,例如一些基本首选项,但如果没有服务器端脚本访问某处的数据库,它们看似执行的任何身份验证实际上都不会执行任何操作。

附带说明一下 - 我曾在一个网站上工作过,该网站的内容实际上是静态的,但看起来像博客或 CMS。这绝对是一场噩梦,而且非常容易出错。

您认为哪些网站没有使用服务器端脚本?

You're not going to see whether a site is using a server side language unless they let you see the file extensions. With URL rewriting, MVC patterns, etc., it's easy to hide, or even fake that information. Therefore, chances are very good that the sites that you think aren't using a server side language are actually using one.

Now, a site can save certain information in cookies, such as some basic preferences, but any authentication they appear to be doing wouldn't actually be doing anything without a server-side script accessing a database somewhere.

As a side note - I have worked on a site where the content was actually static, but made to look like a blog or CMS. It was an absolute nightmare and hugely error-prone.

What are these sites that you think aren't using server-side scripting?

那伤。 2024-11-14 18:02:12

如今,许多网站都使用 Javascript 作为服务器端解决方案,其中 Node.js 是最受欢迎的。查看此列表:https://github。 com/joyent/node/wiki/Projects,-Applications,-and-Companies-Using-Node

Nowadays a lot of sites are using Javascript as a server side solution, Node.js being the most popular. Check out this list: https://github.com/joyent/node/wiki/Projects,-Applications,-and-Companies-Using-Node

千秋岁 2024-11-14 18:02:11

从本质上讲,除非您具有某种服务器端编程能力,否则您没有机会创建具有任何功能的网站。为您分解一下:

没有服务器端脚本您可以做什么:

  • 提供静态页面

您需要服务器端脚本的目的:

  • 绝对是其他一切

即使是像保持网站一致和最新这样简单的事情也是一场噩梦至少没有某种管理系统来预先生成要提供的静态页面。 (从技术上讲,有人可能会争辩说,在记事本中复制+粘贴也算作这一点。)

正如其他地方提到的;混淆正在使用的系统的真实本质是微不足道的;在使用 PHP 时,以 .html 结尾的 URL 没有问题。

编辑:在我能想到的最反常的情况下,你可以有一个lighttpd服务器伪装成IIS服务器,提供由Perl提供给它的离线渲染器生成的页面FastCGI 脚本,与 PHP 签名标题一起发送,并使用 .asp 和 .jsp 文件扩展名的混合。

当然,没有人会做这种傻事。 我认为...

Essentially, unless you have some sort of server-side programming, you don't stand a chance at making a site with any amount of functionality. To break it down for you:

What you can do without server-side scripting:

  • Serve static pages

What you need server-side scripting for:

  • Absolutely everything else

Even something so simple as keeping a site consistent and up to date is a nightmare on wheels without, at the very least, some some sort of management system that pre-generates the static pages to be served. (Technically, one could argue that Copy+Paste in Notepad counts as this.)

As has been mentioned elsewhere; obfuscating the true nature of precisely what system is being used is trivial; and having URLs ending in, say, .html while using PHP is no issue.

Edit: In the most perverse case I can think of off the top of my head, you could have a lighttpd server masquerading as an IIS server, serving pages generated by an offline renderer fed to it by a Perl FastCGI script, sent together with PHP signature heading and using a mix of .asp and .jsp file extensions.

Of course, noone would do something as silly as that. I think…

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文