Is there any extension or feature in VS2010 for previewing in multiple browsers (at the same time) the same as there is in Microsoft Expression Web 4? I know there is the "Default Browser Switcher" extension but this only lets you view one browser at a time.
Cheers
Will
When you right click on the page to do the "Browse With...", you can set multiple defaults. Once you have added in multiple browsers to the list, you can CTRL Click each one you want (to highlight multiples). Once the desired ones are highlighted, click "Set as Default". From then on, whenever you hit "Browse" it should open in all your "Default" browsers you highlighted.
I have found a solution on how to preview a MVC application in multiple browsers by adding a few answers together.
What you do is add an .aspx page into your project and set this as the startup page when you run the project.
Then with your project set it so that you are automatically redirected to another page, be it "Login" or a "Home" page.
The last step is to use #Walls answer
When you right click on the page to do the "Browse With...", you can set multiple defaults. Once you have added in multiple browsers to the list, you can CTRL Click each one you want (to highlight multiples). Once the desired ones are highlighted, click "Set as Default". From then on, whenever you hit "Browse" it should open in all your "Default" browsers you highlighted.
Now when you run the project it will start up all of your default browsers for testing.
Related
I am trying to test sample code for web extension for browsers.
But, it doesn't work. I checked the console for Google Chrome and also for Firefox. It doesn't print anything. The following is my code:
manifest.json:
{
"description": "Demonstrating webRequests",
"manifest_version": 2,
"name": "webRequest-demo",
"version": "1.0",
"permissions": [
"webRequest"
],
"background": {
"scripts": ["background.js"]
}
}
background.js:
function logURL(requestDetails) {
console.log("Loading: " + requestDetails.url);
}
chrome.webRequest.onBeforeRequest.addListener(
logURL,
{urls: ["<all_urls>"]}
);
console.log("Hell o extension background script executed");
Am I missing something?
Your code is correct as written, it works and outputs to console.
If you are not seeing it, then you are, probably, looking at the wrong console.
1. Firefox
Mozilla describes what extension output can be seen in which console in their Debugging article.
Browser Console
The Browser Console no longer shows output from WebExtensions background pages by default. You can have it show output from all WebExtensions by selecting to display "Show Content Messages", which is available from the popup that opens when you click on the gear-like symbol "⚙️" in the upper right of the window, just to the right of "Requests". Depending on what you are doing, the Browser Console may show output from a WebExtensions Experiment. You can access the Browser Console from Tools➜Web Developer➜Browser Console (keyboard shortcut Ctrl-Shift-J, or Cmd-Shift-J on Mac).
In older versions of Firefox, this was the console to use to see output from extensions. However, that is no longer the case.
Browser Toolbox
If you have it enabled, you could also use the Browser Toolbox console. You can access it from Tools➜Web Developer➜Browser Toolbox (keyboard shortcut Ctrl-Alt-Shift-I; On a Mac: Cmd-Alt-Shift-I). If it is not available you can enable it through options from the Web Console settings page.
The console in this toolbox will show output from both scripts running in the background context and from content scripts. However, complex data will not be available (e.g. no Objects).
Add-on Debugger
This is what you should be using to view console output from scripts running in the background context of your WebExtension. This includes background scripts, scripts running in popups, options pages, and any other page loaded from the extension as the main URL for a tab, or iframe. You can access the Add-on Debugger though about:debugging➞Inspect (use the "Inspect" button that's associated with the WebExtension you are debugging; there's a separate button for each extension). This will open a new tab with the debugger. You can then click on the Console tab within that browser tab. This console will display only content from the WebExtension which you are inspecting.
Web Console
You, probably, are looking at the Web Console (keyboard shortcut F12) which is associated with only a single tab. This is what you want when debugging a webpage, but not an add-on's background scripts. For a content script which is injected in that tab, the console.log() output will show up in this console. However, you will not see output from any other portion of your add-on (e.g. not content scripts in other tabs, not background scripts, etc.).
2. Google Chrome
Showing the correct console for your extension is a bit more complex in Chrome. Console output will show up in only one of multiple possible places, depending on from what context the console.log() was executed. Each of the following DevTools are independent of each other and are displayed in separate windows, or tabs. Displaying in the associated tab (bottom or side) is the default for the DevTools associated with web pages and content scripts, because those are specific to the tab. For the web page/content script DevTools, you have the option of having it displayed in its own separate window, or docked inside the tab (side or bottom).
Background Scripts
As explained here, you have to go through multiple selections on a drop-down menu, to get to the chrome://extensions page (or you can type that in by hand as the URL, or use a bookmark) then select both a checkbox ("Developer mode") and then click on the "background page" link. Then, you have to select the "Console" tab on the window that pops up.
It is much easier to show what you have to do:
Content Scripts
Output will be shown in the regular web console (in the web Developer Tools). You can open it by pressing F12 (or other shortcuts) in the webpage in which your content script was injected. Each web console will only show the output from the scripts injected in that tab.
Doing the above with show the console.* output from your extension, but will result in the console JavaScript command line, debugger, etc. being in the context of the page, not the content script.
If you want to use the console JavaScript command line in the context of the content scripts which are injected into a web page, you need to select your extension's content script context from the drop-down menu in the upper left of the Console window. This drop-down menu will normally start with the value "top". The drop down will have selections for each of the content script contexts (one per extension that has script(s) injected).
Popup (built-in)
Right-click on your browserAction button and select "Inspect Popup". Alternatively, right-click within the popup and select "Inspect". Either will open the DevTools for the popup page. The popup will be kept open under more conditions than it normally would, but will still be closed if you switch tabs, etc.
Options
Right-click within the main content of the Options popup (not the title bar) and select "Inspect". This will open the DevTools for the options page.
Devtools extension panel
Same as Options above: right-click inside + inspect.
In case your panel intercepts the right-click or in a bugged Chrome 97/98, open devtools-on-devtools, then use its picker button in the toolbar of the Elements panel (or press Ctrl-Shift-C on PC) to select your panel in the original devtools window.
Tab or popup (detached) with a page from your extension
When a tab or a detached popup window is focused, you can open the DevTools by pressing F12 (or other shortcuts), or by opening the context menu (right-click) and selecting "Inspect".
Note, the "detached popup" here means a window without an address bar, which is created using window.open or chrome.windows.create. There was another type called "panels", but it's no longer supported in modern Chrome.
Which console are you viewing in for the logs?
If you are viewing console on a tab, then that is the wrong place.
Open settings / Extensions or in a new tab type
chrome://extensions
Under your extension click on "background page" link which is where you can watch for logs
**Make sure Developer mode is checked
Yes for Chrome you have to click the background page link mentioned, but it won't be there unless you set it to be persistent:
"background": {
"persistent": true,
"scripts": ["background.js"]
}
I'm in the process of migrating some Web Sites to Web Applications, using Visual Studio 2017. One thing I can't seem to figure out is how do I open multiple .cs files at the same time? I can open the .aspx file for them easy enough by right clicking and choosing Open. I can view the code behind on a single page at a time by right clicking and choosing View Code. In the old Web Sites I could right click multiple files at once and select View Code, however, it appears in Web Applications that option has been replaced with "View Code Gen File" which isn't the same thing. It's painfully slow to open a single page at a time so hopefully there is a setting I am just not finding.
EDIT: As requested, uploading screenshots. Only .aspx files are selected but when more than one is selected the "View Source" option is no longer there. Also I should note that if multiple are selected in Solution Explorer, pressing F7 also has no effect, though that keystroke does work to View Source of a single file at a time.
After further experimentation, I now see what you see and I agree that it's something that Microsoft broke along the way. In fact, in your own image, if you single-select an aspx file in Solution Explorer then you can see the "<>" icon appear in the button bar at the top of Solution Explorer. But that icon disappears whenever you select two or more aspx files.
I've done a lot of work with Visual Studio over the years and I can't imagine any justifiable reason why Microsoft would have deliberately removed the View Code option from the context menu for multiply selected aspx files.
This appears to be a bona fide bug that should be reported to Microsoft.
Meanwhile, as a workaround, use the File | Open option in Visual Studio 2017 and, in the resulting Open File dialog box, simply multi-select any .cs files you need (this dialog box allows you to multi-select files and open all of them at once).
I'm doing some web development and when I push the debug button it starts off with the selected tab and it is really annoying because it will throw errors because those pages are not meant to be ran at first. Is there a way to have visual studio always run a default page first?
Right click the page you want to be the start page and select "Set As Start Page:"
Check out the Web Application's Properties Window, Web Tab. It has a box where you can enter the URL to load upon starting debugging.
That is; Right-click on the project item in the Solution Explorer, choose 'Properties', then click the Web tab, and select the proper option for your needs.
You can also right-click on your desired start page and select Set as Start Page.
I just starting working with Visual Studio and I find that debugging web apps is rather annoying. After making a change and clicking f5 it sends you to localhost:port/ however many times you are not editing localhost:port/ but you are editing localhost:port/someOtherFile, so you can see how this can be pretty annoying.
I am hoping that there is a way to optimize this. Ideally I would want to be able to hit f5 and have it just refresh whatever tab in my browser has localhost:port/whatever/youGetThePoint If this is possible it would make for some really nice debugging because many times you would never even have to click the browser.
Also, why do we have to hit shift+f5 to stop debugging. Why not just f5...
EDIT: I am using MVC2
In Visual Studio, right click on the file (Mypage.aspx -?) you want to start debugging with and select "Set As Start Page."
This will automatically open that page instead of root.
Click on your application in the solution manager
View -> Property Pages
Select the 'Web' tab on the left
Set 'Start Action' to a specific page.
You can select any page in the web project to be the startup page - once you click F5, the browser will start at that page.
Two things you can do:
You can set your web application to use your local IIS for debugging. I'm assuming you're using the standard settings that get setup whenever you create a new web app project.
To set your project to use IIS first make sure you have IIS installed on your dev machine. Select the web application project from the Solution Explorer and then right click. Hit the properties selection. The first tab on the right (build), should allow you to configure IIS to have an application for your project. It will eliminate the port number part and should be a bit easier to navigate around in.
Second thing you can do is find the page you want to go directly to and right click on it and set it as the start page ("Set As Start Page").
Also, you can Google for a Visual Studio macro that will attach to the IIS worker proc so you don't have to refresh what the browser is currently doing. You can also go to the debug menu item and select "Attach to Process..." and then find the worker proc and attach to it.
I believe Start Options might do the trick for you.
Right-click on the project, and select "Start Options..."
On the Start Options dialog under "Start action" heading, you may specify a page or start URL.
This is how I expected the toolbox to work:
Let's say I add a custom Tab to the Toolbox called "Ajaxtoolkit." To add controls to the new tab, I right mouse click and select "Choose Items" and browse to a file, Ajaxtoolkit.dll, that is of a particular version number.
I would expect that when I save and reopen the solution, that the Ajax Toolkit custom tab would still be in my Toolbox and that it would contain the same controls that were there last time, the controls that were in the dll that I referenced when the controls were added.
If I created a brand new web app, I (possibly) wouldn't expect to see the same Ajax Toolkit custom tab. However, I could perform the same steps as above and add a "Ajax Toolkit" tab and perhaps, this time, select a DIFFERENT VERSION of the tookit, and the state of the toolkit would be retained with each solution file.
Another possibility would be for the original Ajaxtoolkit to be retained when the 2nd web solution is created, and perhaps, if I wanted to mix versions of the toolkit across diffreent web sites in my solution, I should start naming my custom toolkit tabs with version specific names like "Ajaxtoolkit 4.0," etc.
...But instead, the Ajaxtoolkit tab disappears when I close VS2010 and reopen it.
Why? Is this desirable behavior or a bug?
You know VS2010 is a fully customizable IDE, may be these features conflicts your toolbox customization.