Open URL from Terminal without "http://" prefix - terminal

This might be a stupid question, but I will ask it anyway. When I try to open a URL (like google.com) from Terminal using the open command, I get the following error:
The file /Users/jack/Desktop/google.com does not exist.
Perhaps you meant 'http://google.com'?"
How can I open "http://google.com" without having to use the http:// prefix?

I'm having a difficult time interpreting your question, so this might not even answer your question.
TL;DR;
As far as I am aware, there is no way to do what you are asking. It is possible that there might be a third-party application out there somewhere that will do roughly what you want, but I am not aware of one off the top of my head.
The longer answer
The problem here is how your OS processes your request. When you say "open {name-of-something}, your computer opens the "something" with its default application. For example, on MacOS, a .txt file might get opened with TextEdit.
However, you can also define the protocol with which you want to open your "something". In the case of URLs, you are opening the URL using the http protocol. Your computer knows that anything with the http:// protocol prefix gets opened in your default web browser (and then your web browser handles it from there). When you do not add the http:// prefix, your computer doesn't know that you want to open "google.com" with the http protocol, so it thinks it's just a file.
Bottom line, you must have the http://.
Disclaimer to computer geeks: I apologize if this is not the best explanation. I'm self-taught, so some of my vocabulary might be a bit off.

Related

How to make Firefox open RSS directly (like other XML files), instead of downloading?

Using Firefox 70.0.1 on Arch Linux. (I realize that this question might technically belong on SuperUser, but I suspect that no non-developer would ever need to do this.)
I'm trying to debug my code that generates an RSS feed, by viewing it directly in Firefox's XML viewer.
When I enter a feed URL, like https://en.blog.wordpress.com/feed/, Firefox pops up the dialog that asks me what to do with the file. It calls it an "RSS Summary", and I can choose to open it or save it to disk.
I can choose to open it in Firefox, but then the file is first downloaded to disk, and then opened from a file:// URL. The result is that I can't hit F5 to refresh it; I have to enter the URL anew.
This only happens if the Content-Type header is application/rss+xml. A file served up as plain application/xml (like e.g. https://xkcd.com/rss.xml uses) is opened directly.
How can I tell Firefox that application/rss+xml should receive the same treatment and just be viewed as a regular XML file?
Add the „view-source:“ prefix in front of your url as said in this article: https://css-tricks.com/snippets/html/view-source-of-rss-feed-in-firefox/
You should be able to achieve this using an extension.
There is Open in Browser which seems to resolve the issue.
When you try opening the RSS URL with the extension installed, you will be shown a window where you can choose which action to take. You can choose to open the file as XML in the browser window. If you want to be able to hit F5 and reload the file, you may also want to tick "Do this automatically for files like this from now on".
Note that I haven't read the source code of the extension so I don't know if it is safe to use or not.

Writing a c# or c++ application which can detect if browser is going to download a file

I am going to write an application which runs in the background on windows platform. If user is working on any browser (IE, Firefox, Chrome, etc) and any of the user action results in downloading activity, the background program should take control. The background program pop-ups a window asking user, if they want to download. If user proceeds with OK, then background program sends signal to browser to stop its download process and the background program will do download. If user rejects download by the background program, then default download of browser can go on.
For this please suggest if any working model is there in c#/VB.NET/C++ or how to achieve this activity.
Will very much appreciate your kind help.
Thanking you very much in advance.
I don't think you understand the whole notion of downloading. Any resource you get from the Internet is downloaded. Hence, anything would trigger your application. You can, however, try to "parse" URL to see the extension but this does not have to mean nothing, since you can give any file an arbitrary extension (well not exactly arbitrary, but you know.. ). Another option is detecting FTP downloads ( i assume this might be of more interest ). This way you'd "only" have to check for a specific protocol. The reason i quoted only in the last sentence is that none of these tasks is a simple one.
You basically want to write a Proxy, or use an existing one.
You might wanna take a look at WinPcap
Finally, none of this options really give you the infromation whether user is going to download a file. But if you write a proxy, you could stop the endpoint application of obtaining that file once you download it.

What's the proper way to call VBScript from Firefox?

I'd like to be able to call a vbscript from Firefox that resides on network share. Thus it is visible to all my team members at work. Using:
<a href='file://///server/path/to/file.vbs'>run me</a>
What this script does is it grabs server side information through Samba from the client-side, and uses that information to bring up a MS Outlook new e-mail window with the HTML formatted server side (a Linux system) information filled in. I do not send the e-mail yet because I want to allow the teammate to make sure what they are about to send is correct. And we have to use Outlook. Unfortunately mailto: does not appear to allow any kind of HTML formatting, which is why I've turned to VBScript.
Seems to work in IE, although you get prompted before it allows you to run it. I guess that's OK for now. It's a little annoying having to make sure you're in IE to run it, especially for those of us who prefer not to use IE.
Right now all Firefox does is display the code contents in the browser.
I'm not even sure if I'm going about all this the right way, but from where I stand, I guess I'd like to be able to run it from Firefox. If not, I'll survive. Thanks
I don't think this is possible. Even if it is, it's probably a security risk.
To launch the script, you'll have to run "wscript.exe file.vbs", but that's not allowed otherwise Viruses can exploit this easily.
Therefore, unless you want to use some browser exploit, this will not be possible.

Open TFS Work Item Attachment in Image Viewer not Web Browser

Is there a way to open an attachment for a TFS work item by double clicking on it (or rather just opening it from the IDE) in your computer's default image viewer, rather than opening it in a web browser? I'd love to be able to change this setting (if it is a setting).
Edit: after reviewing Kate Gregory's response, I looked into this option and realized that the trouble is that VS is launching a url (a handler file to respond with the attachment), which results in the default web browser being launched. A potential work around i'm considering is writing a custom mapper for all web based calls (as in, when going to start->run and enter a URL) that the mapper would determine what kind of call it is (TFS, etc) and use an appropriate program, based on the MIME type responded with, with a second phase to be incorporate this as a VS add-in.
I'm reasonably sure VS just uses your default program. Word for .doc files, IE for .htm files, and (in your case I bet) IE for .jpg files. Try changing the default program you're using in Windows and see what happens.
All files saved in TFS are saved in a path that starts with the following address:
http ://{YourServerName}TFS01:8080/tfs/.../.../...&FileName={YourFileName}.{YourExt}
This means that all files are opened using the default program defined for HTTP protocol, regardless of the extension for your file.
You can probably change the default program for your HTTP protocol (if you have permissions, and usually you wouldn't) but this would also affect opening any regular web page or URL, which is probably not recommended.
I still haven't found a workaround this issue too.
Some kind of preview function in VST/Team Explorer would be nice. Then, only a minor of attachments must be opened in the browser.
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/6224713-preview-attachments-in-team-explorer

How to get the last current or visited Web URL in Windows?

I'm writing a Windows app. where you can create "links", it is easy to link files or folder (just use the standard dialogs for open files or browse folders), but for linking a Web URL I don't know how to get (from a Windows function or registry key) the current or last visited page.
Maybe something like the recently used files, but referencing web pages (independent of the browser), could be useful.
There is no common browser independent place to look for the last visited pages from what i know(i'm saying this from my experience at computer forensic)
I know there is a place in the registry where explorer saves this info, and probably other browsers as well, you can find this info by using a tool like procmon by sysinternals.
Just enter a site and see what the registry writes down..
This might give you a start:
wrapper class for URL history interface in C#
I found it! (at least for IE)...
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs
Then, I should find the equivalent key (or maybe a config file) of the other most common web browsers.

Resources