user1950701
user1950701

Reputation: 49

Script html websites with c++?

I was wondering if there's a way for scripting websites with c++ instead of or in addition to javascript? DO I put

<script type = "text/c++" src="script.cpp">//code here</script> 

?

Upvotes: 0

Views: 3503

Answers (3)

Jackie Tate
Jackie Tate

Reputation: 21

Yes, but you need to use a web framework like TreeFrog. TreeFrog is a full-stack web development framework, so you would be able to use C++ for both the front and back ends.

Upvotes: 2

Mats Petersson
Mats Petersson

Reputation: 129524

Yes, that will work as soon as you write your own browser that contains a C++ compiler (or parser). Please tell me which browser that is, so that I can make sure it never gets anywhere near any of my machines, since I definitely wouldn't want a full-fledged C++ program running on my machine - what's to say it's not got code in it that can do harm to my machine (delete files, write to registry, whatever)?

If you actually want your web-clients to have a private program of yours, you'd better distribute it in an already compiled executable or browser plugin [but beware that like me, many others probably won't download it unless you are part of a reputable organisation].

Upvotes: 1

Quentin
Quentin

Reputation: 944538

The only language supported reliably (in script elements) across browsers is JavaScript.

Internet Explorer also supports VBScript. Given a plugin from ActiveState (which I think may be discontinued now) IE also supports PerlScript.

You can embed a program written in C++ using ActiveX — but that requires Internet Explorer on Windows on x86 hardware (so not Windows 8 RT) and is blocked by default security settings.

You can use any language you like for server side code, providing you can interface it with a webserver. CGI and FastCGI provide standard interfaces with supporting libraries for most languages.

Upvotes: 3

Related Questions