Show a browser in a tab

Is it possible to show a browser in a webstorm tab? Is there plugin for this? I would like to preview without having to switch to chrome.

6
9 comments

We used to have built-in browser in IDEA but had to abandon it - it turned out that external browser was the better choice since
a) external browser is closer to the one needed for your target (e.g. targeting Chrome, Mobile Safari / Opera, etc)
b) embedded browser does not live well with Swing application (e.g. focus quirks).

But probably we'll consider re-evaluating this feature.. Please feel free to vote for https://youtrack.jetbrains.com/issue/WEB-10499 to be notified on any progress with it

0

Is this still the case? I have a html page in my project which renders an viewer/editor for certain file types. In my intelliJ plugin I would like to use this page inside an intelliJ tab to show/edit files of these types inside my project. What would be the best approach?

0

yes, still the case, nothing has changed

0

Thank you. So accepting that the page will be opened in an external browser, I tried using

VirtualFile file = (VirtualFile) e.getData(PlatformDataKeys.VIRTUAL_FILE);
VirtualFile folder = file.getParent();
BrowserUtil.browse(config.getTarget() + file.getUrl());

which leads to:

http://localhost:63342/my-intellij-plugin/my-intellij-plugin.main/html/viewer.html?url=file://C:/Users/my%20name/IdeaProjects/untitled/src/test.xml

It does not work due to access restrictions to the local file system. My viewer works if I change the url parameter to http://localhost:63342/my-intellij-plugin/my-intellij-plugin.main/html/viewer.html?url=http://localhost:63343/untitled/test.xml?_ijt=cb42s61vredg568buriphjcrfl
How can I generate such a secured file url exposing my project file under localhost?

The approach is not flexible or robust.

Currently http://localhost:63342/camunda-intellij-plugin/camunda-intellij-plugin.main/html/viewer.html is hardcoded.
How can I assemble the viewer url dynamically?
Apart from the project name, how is this url going to change on different installations?
Will this approach work in a full; installed plugin? Is there any way to control port, web application context root?

It would be very helpful to see source of a plugin that does the same as using the "Open in Browser" function manually. If you are aware of any, please point me to it.

 

 

0

Ndcain, there now is a plugin called GIdeaBrowser which opens websites inside of IntelliJ IDEA. Unfortunately it only supports YouTube URLs. :-(

-1

WebStorm 2021.1 will come with the built-in HTML preview; you can try in in EAP builds. See https://blog.jetbrains.com/webstorm/2021/01/webstorm-2021-1-eap-1/

1

This feature would be great for reading documentation or following a tutorial.

1

Particularly being able to have https://www.packtpub.com/ books/tutorials in one window within the IDE would be super.

0

Upvote!

Often I may have multiple projects going at the same time and having the browser for "this" project in "this" Intellij window and "that" in "that" would be very helpful and convenient.

0

Please sign in to leave a comment.