Passing File URL to browser

Silly question. Why cant perspective pass a file URL to a browser. Or can it and I’m just missing something? I have URL Links for PDF file. My browser can support viewing PDF’s. If I type the link in myself it works fine but when use perspective to initiate it’s a no go. And yes I know there is a component for this but trying to stay away from the webdev stuff.

I don’t fully understand what you’re asking, but I’m assuming when you “type it in myself”, you type file:///C:/Users/<your_username>/Desktop/some_file.pdf.

If that assumption is correct, you’re correct, you won’t be able to pass in a file to the browser from anything other than a file:///<location> . Perspective uses http / https to deliver responses to the browser, not the file protocol.

If you need to serve files, you would need some sort of endpoint on the Gateway (which would be very easy to do with WebDev) or a standalone web server.

Correct in my browser I can type file:://mycompany.com/location/file.pdf and it will open up in the browser. I’m not trying to pass the file. Just trying to pass the file URL (file:://mycompany.com/location/file.pdf) to the browser. Sorry just not understanding the difference between perspective passing an HTTP link vs the link mentioned above. I don’t think I’m asking perspective to serve files. Just asking it to tell the browser to navigate there. Or at least in my simple mind that’s what I’m trying to do.

It’s not a Perspective “problem”, it’s a browser security restriction. If you open the browser console, you’ll see something similar to this:
(Firefox)


or this:
(Chrome)
image

You could theoretically work around this security restriction via some setting, or possibly with an extension, but doing so then opens your browser up to a class of security vulnerabilities.

1 Like

@PGriffith Thanks! I get the issue now and makes sense to me. Looks like there are some workarounds out there, if one was inclined. Not sure if I will head down that path.

1 Like