§
पोस्ट केले: 2020-10-24

I know this is probably trivial for some of you, that's why I'm asking instead of making my own

I need a script that can turn regular urls to file urls.
What is it for: I'm using notion.so and what to link to local file system, however the only allow http:// links and not file:/// links.
I need something to do the translation from a valid url to a file url somehow.

Know of such script?

§
पोस्ट केले: 2020-10-24
संपादित केले: 2020-10-24

Open any http website, and the http part of the website will be replaced to file:///
so like http://greasyfork.org/
will be file://greasyfork.org/

Is this what you want?

document.location.replace(document.location.href.replace('http:/', 'file:///'));

§
पोस्ट केले: 2020-10-24

It doesn't work on chrome
Actually you can't open external link due the browser being sandboxed

§
पोस्ट केले: 2020-10-24
संपादित केले: 2020-10-24

Oh, I see...
So your browser blocks any http requests (websites), and your browser only opens file:/// "links" right?
And you want a script to unblock the http websites on your browser right?

If this is your case, then....
The script does work, but the problem is that websites are blocked on your internet/browser, so tampermonkey doesn't recognize and doesn't run on the website,neither on files I guess. This might be an tampermonkey bug, or not I don't know.

It's much better if you go to google and search for something like "redirect extension" for your browser, there are lot's of extensions on your browser store that does what you want, maybe one of them will work for you.

You should probably check this https://helpdeskgeek.com/how-to/block-websites-using-hosts-file/ But replace 127.0.0.1 with the correct ip for the websites that you want to access, maybe your network adm blocked that website using the hosts file, if yes then will be really easy for you to unblock that website.

You can also download any VPN or proxy (like UltraSurf) and that will probably unblock all the websites on your network too. There are even some browser extensions that are VPN/Proxy extensions, like the BrowSec and Hola for example.

You can also try to download and execute The Tor Browser, or the Opera Browser that comes with an built in VPN.

There are also dozens of online proxys and website unblockers for free for you to use, like this one for example https://unblock-websites.com/

§
पोस्ट केले: 2020-10-24

I think the only way I'll ever achieve it is by developing my own extension

§
पोस्ट केले: 2020-10-25
संपादित केले: 2020-10-25

No, even if you have enough knowledge to create your own browser extension, that wouldn't work. There are lot's of, and pretty good extensions that can redirect you and modify the website url.

The only way to achieve what you want, is to use an vpn or proxy that can bypass your browser/network block rules.

It's not possible to make any js scripts or browser extensions that can "do the translation from a valid url to a file url somehow"

Valid urls, are not valid files at all and vice-versa

§
पोस्ट केले: 2020-10-25

Okay so it took some time but I was able to find a solution
I replaced the innerHTML with my link, and added an extension that enables local file links
Too much work for something not so comfortable and not so secure but it works

§
पोस्ट केले: 2020-10-25
संपादित केले: 2020-10-25

Nice. I just understood what you wanted now I guess. I've never seem something like this before...
You can try making an .html file an opening that on your browser, since your browser only opens files, then on that .html file iframe the website that you want to access,for example

full screen iframe codes https://pastebin.com/REiBqiUH

उत्तर पोस्ट करा

उत्तर पोस्ट करण्यासाठी साइन इन करा.