Git Product home page Git Product logo

Comments (21)

blineadam avatar blineadam commented on May 13, 2024 7

For anyone else having this issue a workaround is:

  1. Package your app with a bogus url. For example
    nativefier --name "SomeAwesomeApp" --insecure --ignore-certificate index.html
  2. Navigate to the folder that was created and drop all of your files into the base directory (so they are at the same level as SomeAwesomeApp.exe)
  3. Navigate to resources\app\nativefier.json
    a) Change the targetURL to "targetUrl":"file:///index.html"
  4. It will run with the local html pages/js/css/images/etc.

from nativefier.

IonicaBizau avatar IonicaBizau commented on May 13, 2024 4

Any news on this?

from nativefier.

semi-automatique avatar semi-automatique commented on May 13, 2024 2

I just made a proof of concept with a local file on Windows 7 - 32 bits that is working. It seems you just need to modify the file nativefier.json. Change the default value for "insecure" to true.

I don't know yet if it is working on other OS and what can be done to minimize the security risk when that value is true. Feel free to put a note here if you can confirm the solution is working for other OS or if you have any idea to prevent potential security nightmare when you do that.

    {"name":"MY_APP",
    "targetUrl":"file:///./maquette/MY_LOCAL_FILE.html", 
    "counter":false,
    "width":1280,
    "height":800,
    "showMenuBar":false,
    "fastQuit":false,
    "userAgent":"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36",
    "nativefierVersion":"7.1.0",
    "ignoreCertificate":false,
    "insecure":true,               <---- CHANGE DEFAULT VALUE TO true.
    "flashPluginDir":null,
    "fullScreen":false,
    "maximize":false,
    "zoom":1,
    "internalUrls":null}

from nativefier.

paradajz avatar paradajz commented on May 13, 2024 1

For anyone else having this issue a workaround is:

  1. Package your app with a bogus url. For example
    nativefier --name "SomeAwesomeApp" --insecure --ignore-certificate index.html
  2. Navigate to the folder that was created and drop all of your files into the base directory (so they are at the same level as SomeAwesomeApp.exe)
  3. Navigate to resources\app\nativefier.json
    a) Change the targetURL to "targetUrl":"file:///index.html"
  4. It will run with the local html pages/js/css/images/etc.

This indeed seems to work on Windows, however, I can't get it to work on Ubuntu. It works only if I specify full, absolute path to the index.html. Any workaround for this?

from nativefier.

sailnationcove avatar sailnationcove commented on May 13, 2024 1

For anyone else having this issue a workaround is:

  1. Package your app with a bogus url. For example
    nativefier --name "SomeAwesomeApp" --insecure --ignore-certificate index.html
  2. Navigate to the folder that was created and drop all of your files into the base directory (so they are at the same level as SomeAwesomeApp.exe)
  3. Navigate to resources\app\nativefier.json
    a) Change the targetURL to "targetUrl":"file:///index.html"
  4. It will run with the local html pages/js/css/images/etc.

I can't get it to work on OSX. It does not displays the html file.

from nativefier.

stevebutterworth avatar stevebutterworth commented on May 13, 2024 1

Would really appreciate an option to make this possible cross platform. Seems like a potentially neat and straight forward way of distributing basic html/js apps.

from nativefier.

snellingio avatar snellingio commented on May 13, 2024

+1

I love this idea. Going to give it a shot later tonight.

from nativefier.

flaird avatar flaird commented on May 13, 2024

+1
Any progress here? When I attempt nativefier http://app.local it's doing a lookup at googles DNS 8.8.8.8.

from nativefier.

debopamsengupta avatar debopamsengupta commented on May 13, 2024

@snellingio anything ? else I'll give it a try over the weekend :)

from nativefier.

jiahaog avatar jiahaog commented on May 13, 2024

Somework seems to have goine into this in #48, but I'm not sure why the PR was closed

from nativefier.

jiahaog avatar jiahaog commented on May 13, 2024

@debopamsengupta But feel free to go ahead!

from nativefier.

fastsupply avatar fastsupply commented on May 13, 2024

if you've got a 'net connection try using ngrok (https://ngrok.com/) and a local http server, works well I find

from nativefier.

jiahaog avatar jiahaog commented on May 13, 2024

It's actually just the validator package, if we are able to disable it, using file:// should work.
Insecure just causes the chromium backend to ignore the browser mixed content errors https://github.com/jiahaog/nativefier/blob/da637ebf73b10241a67b766fbfc5ea84839f02b3/docs/api.md#insecure 😄

from nativefier.

manngo avatar manngo commented on May 13, 2024

This doesn’t address the issue directly, but, as a workaround, you could use a simple desktop web server such as Fenix Web Server or Tèsèvè. It takes next to no time to get going, and works well enough for Nativefier.

from nativefier.

monecchi avatar monecchi commented on May 13, 2024

I'm using now which allows you to also deploy static stuff such as html "serverlessly".

E.g. Static Websites

$ my-site/ ls
index.html logo.png
$ my-site/ now

Every time you deploy a project, now will provide you with a new, unique URL, which you might use with nativefier.

from nativefier.

nirmit avatar nirmit commented on May 13, 2024

And I am assuming we still have a way of doing this, on all platforms!?

from nativefier.

BrunoQuaresma avatar BrunoQuaresma commented on May 13, 2024

Having the same issue here.

from nativefier.

johnblackmon avatar johnblackmon commented on May 13, 2024

The problem on OSX is that no matter where you run the electron app, your "working" directory is "/", so it looks for the index file at the root. We would need a build of Nativefier that sets the working directory to the same directory the app is in, which is the default on Windows.

from nativefier.

azhinu avatar azhinu commented on May 13, 2024

I find a some weird but working on all platforms way:

  1. Compile Nativefier app with any target, eg:
    nativefier -i icon.png --disable-context-menu --disable-dev-tools -n "Your App name" anything
  2. Put your website files to nativefier_app_dir/resources/app/local
  3. Open nativefier_app_dir/resources/app/lib/main.js
  4. Replace all the options.targetUrl with file://${path.join(__dirname, '..', 'local/index.html')}

from nativefier.

tecmoc avatar tecmoc commented on May 13, 2024

Hi @azhinu, thank you for the workaround. I tried your solution and the first thing is I think you're missing a "`" at the end of the path to the local files. After fixed that Nativefier works, but when I try to open links it sends an error:

Uncaught Exception:
ReferenceError: path is not defined
at onWillNavigate (/Mypath/Contents/Resources/app/lib/webpack:/nativefier-placeholder/src/helpers/windowEvents.ts:135:15)
at EventEmitter. (/Mypath/Contents/Resources/app/lib/webpack:/nativefier-placeholder/src/helpers/windowEvents.ts:197:5)
at EventEmitter.emit (node:events:402:35)

You or somebody knows how to fix this??, There's something else to disable in nativefier??

Thank you very much

from nativefier.

azhinu avatar azhinu commented on May 13, 2024

Hi @tecmoc, I not clearly remember, but probably "`" symbol not missing at the end. It can be a wrong Markdown markup.

from nativefier.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.