Skip to main content
bagonterman
Inspiring
January 4, 2019
Question

using app.openUrl to open file in browser loses colon

  • January 4, 2019
  • 1 reply
  • 1368 views

var path="Users/bagonterman/Desktop/";

var file="Tutorial.pdf"

var colon="%3A"

var colon=":"

app.openUrl("file"+colon+"///"+path+file);

I would like to either open up a pdf or html and I can do neither because when I send this the colon disappears.

It shows up like this file///Users/bagonterman/Desktop/Tutorial.pdf . I think that it may be because it is automatically putting http:// in front

and then it does not accept the colon after that. Any ideas as to how I could get around this?

This topic has been closed for replies.

1 reply

Kukurykus
Legend
January 4, 2019

For now I have no idea how to make that worked the way you tried, but temporarily you may use this method:

app.system('start chrome.exe "file:///Users/bagonterman/Desktop/Tutorial.pdf"')

However I'm on Windows with Chrome browser, but it should work on Mac if you choose other browser and 'open' command instead of 'start'. By the way, if I changed 'chrome.com' to just 'chrome' it works as well since I installed it.

bagonterman
Inspiring
January 4, 2019

I tried this and received a 256.Maybe I need to look at how that runs on the mac side. It might not be exe

app.system('open chrome.exe "file:///Users/bagonterman/Desktop/Tutorial.pdf"')