Can I load a site using nw.js

I know that nw.js is usually intended to load html on the client, but can it also point to the website and show it? When I set the "main" value in package.json to something like google.com, it does not work.

I am looking for creating a game launcher application that displays a website for my game and has the ability to log into the system, as well as from the launch bar, and then put it into the exe game. Because of this, I would like parts of nw.js to really connect to the network and display the website.

+4
source share
4 answers

Of course you can (use JavaScript):

index.html "main": "index.html", index.html( html)

<script>
        // similar behavior as an HTTP redirect
        window.location.replace("http://google.com");
</script>

<script>
        // similar behavior as clicking on a link
        window.location.href = "http://google.com";
</script>

: - , .

0

Chrome <webview> .

:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <style>
            html, body, webview { width: 100%; height: 100%; }
            h1 { text-align: center; }
        </style>
    </head>
    <body>
        <h1>Please log in:</h1>
        <webview id="login-view" src="http://example.com/"></webview>
    </body>
</html>

"" () "" () ContentWindow WebRequestEventInterface.

0

iframes :

   <body>
   <iframe src="http://yourwebsite.com"></iframe>
   ...
   </body>

0

:

  • (/, , ) https, , ajax.
  • , . exe, , , .

( , ) - iframe/webview. , Facebook :

  • webview/iframe
  • url iframe
  • - , , , URL- iframe . Facebook , Facebook url , , , .

This is pretty general, but I don’t know if you can write some kind of user logic on the remote login page; for example, make it return session data in JSON instead of cookie.

0
source

Source: https://habr.com/ru/post/1626557/


All Articles