How Do I Change Firefox Homepage In VB2011 Code
I want to change the url homepage of the firefox browser by running that EXE file
is this possible
If you want to change the Firefox's home page form a program running on the user's computer, you have to edit the prefs.js file and create a new line like user_pref("browser.startup.homepage", "http://www.example.com/");.
Beware that if there are multiple browser.startup.homepage entries every entry will be opened in a new tab when the browser starts up, and that the modification must be done when Firefox is closed, otherwise the changes will be lost.
Related
I'm trying to write MVC endpoint that will optionally set the content-disposition to inline or attachment in order to either display the file (a pdf) inside a new browser tab or else to download it. The UI allows the user to select how they'd like to open the file (not my design - can't change that aspect of it).
Note that this works in Chrome/Edge just as expected.
In Firefox, the application settings for PDF appear to trump the content-disposition. Is there a reliable way to get Firefox to respect the content-disposition? Preferably a way that will work w/ a vanilla installation of the browser such that end-users don't need to make any modifications on their end for it to work.
Here's the code I'm using to setup my response (class is derived from ApiController):
var response = Request.CreateResponse(System.Net.HttpStatusCode.OK);
response.Content = new PushStreamContent((stream, content, context) =>
{
dispatcher.Dispatch(request, stream);
}, new MediaTypeHeaderValue(MediaTypeNames.Application.Pdf));
response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue(contentDisposition)
{
FileName = $"{auto_generated_fileName}.pdf",
};
response.Headers.CacheControl = new CacheControlHeaderValue()
{
NoCache = true,
NoStore = true
};
return response;
We have noticed this issue in our webapp as well. The webapp has a download button that lets the user download a PDF file. Firefox shows the PDF file in the current tab, which effectively kills the webapp.
After a bit of research, this appears to be an intentional feature, see the release notes for Firefox 98:
When you set an application to open files of a specific type in your Firefox preference settings, those files will open automatically, even files served by the website with "content-disposition: attachment". The same applies to PDF files that are set to open in Firefox by default. This is a fix to bug 453455.
Personally, while I can understand some users may want this for web pages that don't behave well, this is an issue for well-behaved web apps.
Setting the download attribute on the anchor does not appear to work either, Firefox still shows the file inline (tested with Firefox 99.0)
So as far as I am aware, you cannot force the browser to download the file if the browser does not allow it. Other web apps such as OwnCloud or Google Drive are having the same issue -- if you click right on a PDF file in Google Drive and then click on Dowload, Firefox still open the PDF file inline, whereas Chrome downloads it.
For now, it seems the best you can do is to open file in a new tab, to prevent the webapp or web page from being replaced by the downloaded file (which is also what Google Drive seems to be doing). You can open the download in a new tab or window e.g. via the target attribute on an <a> links or via the formtarget atttribute on a <button> element.
I found #blutorange's answer after trying to find a solution to the same problem as OP. However, just before I got here, I stumbled across this answer from back in 2013 - https://stackoverflow.com/a/16515146 which suggests to set the Content-Type header to application/octet-stream, instead of application/pdf.
I tried that solution and what do you know - it works! The PDF opens in a new tab in Firefox automatically, but at least it doesn't replace the tab of my application, so yay! Chrome doesn't seem to mind it either and my PDF viewer on my computer also recognizes the files as PDFs.
Now, this might not be the most "correct" fix to the issue we're facing, but it's an alternative to forcing open a new tab.
I have a tool which load a website, fill in the information, and save the result.
It was working fine until last week.
After debugging, I found out the reason is because the site URL "became" redirected.
The redirected sequence is like below. (for example, site url is google.com)
google.com` → google.com\somethingbetween → google.com (yes, the final redirected url is exactly the same as the original url)
If I open chrome and navigate to the url manually, the page is loaded fine. But if opened by selenium chromedriver, it will stop as google.com\somethingbetween. The strange thing is if I manually enter the url inside the address bar of the browser which was opened by ChromeDirver (will have a little popup saying that the browser is currently controlled by automation tool), the browser will also stop at the second page ( google.com\somethingbetween).
I tried to use the Chrome beta version 79 (with chrome driver v79) but the problem didn't go away.
Use Chrome driver of stable version which may help you to get rid of this problem.Because under this version there is an issue of "issue 3133: window.navigator.webdriver is undefined when "enable-automation" is excluded in non-headless mode (should be true) [Pri-2].So do try with the stable versions like v78,v77.
The redirection issue occurs when "driver.get()" method is used. Please try using "driver.navigate().to()" method to navigate to the url. This may solve the issue.
Linking a related question:
How do I switch to redirected url using selenium web driver
Our web-based ERP application prevents a user from opening a second browser window with the same URL, via a bunch of JavaScript that checks window names etc.
The point is, you can only open one instance of the application and if you attempt to open another, you get a warning message and the application refuses to open.
When I use
cy.visit('our application')
the Cypress main window gets updated with our application's URL
the Cypress browser window gets updated with our application's URL
This immediately flags our application as trying to open a second copy which then prevents it from opening in the Cypress-controlled browser, which prevents any further testing!
Is there any way to prevent this happening. I have tried using various flavours of baseUrl in the cypress.json file, but nothing has been successful.
Anyone have any useful ideas?
I have created a website, with a link button that opens a link in IE, and when I run the program locally,
Process.Start("iexplore.exe", myUrl)
works just fine.
However - when I have published my website and run the program from the webserver, every click on my link button will open IE - on the webserver...
Is there a way to make a specific browser open on the local machine?
I have done some coding to set firefox browser profile to download the file automatically into the download directory.
When the browser launches by selenium webdriver it loads the settings which i have set.
Will the browser launches with same profile after removing that part of profile setting code, for every execution of the program.
Please let me know
Thanks in advance.
No, it will load default profile if you remove your profile setting code and run it again. By default it would use default profile until it is mentioned in the initialization code.