PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label firefox. Show all posts
Showing posts with label firefox. Show all posts

Wednesday, November 16, 2022

[FIXED] Why does display:block affect vertical alignment in Firefox?

 November 16, 2022     css, firefox, html, vertical-alignment     No comments   

Issue

See the code below. This looks alright in Chrome and Edge, but it aligns the text to the bottom in Firefox. Also check this CodePen in different browsers to see what I mean. What is causing this?

.table {display:table;}
.row {display:table-row;}
.cell{display:table-cell;}
.input input{display:block; margin:10px 0;}
<div class="table">
  <div class="row">
    <div class="cell txt">
      This is text
    </div>
    <div class="cell input">
      <input type="txt">
    </div>
  </div>  
  <div class="row">
    <div class="cell txt">
      This is text
    </div>
    <div class="cell input">
      <input type="txt">
    </div>
   </div> 
</div>


Solution

To fix this, you can add vertical-align: middle; to your .cell class. Also, I'd create the vertical spacing around items using padding inside the .cell itself. That way, all cells share the same spacing.

.table {display: table;}
.row {display: table-row;}

.cell {
  display: table-cell;
  padding: 0 0 10px 0;
  vertical-align: middle;
}

.input input {
  display: block;
  padding: 20px;
}
<div class="table">
  <div class="row">
    <div class="cell txt">
      This is text
    </div>
    <div class="cell input">
      <input type="txt">
    </div>
  </div>  
  <div class="row">
    <div class="cell txt">
      This is text
    </div>
    <div class="cell input">
      <input type="txt">
    </div>
   </div> 
</div>



Answered By - mfluehr
Answer Checked By - Timothy Miller (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Tuesday, November 8, 2022

[FIXED] why are the bars on the left instead of the right and why does the small screen version need to slide instead of using the function to see the menu?

 November 08, 2022     css, firefox, html, javascript, menu     No comments   

Issue

Hi guys I'm trying to create a mobile friendly header menu with the bars on the right side of the screen. A Javascript for clicking the cross and the bars for opening the menu on the right. Except I have a

  1. the bars are on the left and should be on the right

Can someone help me and give me some insights?

this is how it look in small screen

here's the html code I have

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Home</title>
    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/fontawesome.min.css">
    
</head>
<body>
    <section class="header">
        <nav>
            
            <div class="nav-links" id="navLinks">
                <i class="fa fa-times" onclick="hideMenu()"></i>
                <ul>
                    <li><a href="index.html">HOME</a></li>
                    <li><a href="courses.html">Courses</a></li>
                    <li><a href="endangered.html">Endangered</a> </li>
                                
                    <li><a href="">Contact</a></li>
                </ul>
            </div>
            <i class="fa fa-bars" onclick="showMenu"></i>
        </nav>

    </section>

    <script src="javascript.js"></script>
    
</body>
</html>

here is the css code

*{
    margin: 0;
    padding: 0;
    font-family: "poppins", sans-serif;
    
}

.header{ 
    height: 100vh;
    width: 100%;
    
}

nav{
    display: flex;
    padding: 2% 6%;
    justify-content: space-between;
    align-items: center;
}

.nav-links{
    flex: 1;
    text-align: center;
}

.nav-links ul li{
    list-style: none;
    display: inline-block;
    padding: 8px 12px;
    position: relative;
}

.nav-links ul li a{
    text-decoration: none;
    color: #5ab61d;
    
    font-size: 20px;
}

.nav-links ul li a::after{
    content: '';
    background: #0ace83;
    width: 0;
    height: 2px;
    margin: auto;
    display: block;
    left: 50%;
    transition: all 0.5s;
}

.nav-links li a:hover::after{
    width: 100%;
}

nav .fa{
    display: none;
}

@media(max-width: 700px){
    .nav-links ul li{
        display: block;

    }
    .nav-links{
        position: absolute;
        background: #f44336;
        height: 100vh;
        width: 200px;
        top: 0;
        right: -200px;
        text-align: left;
        z-index: 2;
        transition: 1s;
    }
    nav .fa{
        display: block;
        color: #000;
        margin: 10px;
        font-size: 22px;
        cursor: pointer;
    }

    .nav-links ul{
        padding: 30px;
    }
}

and here is the javascript

/* Toggle between showing and hiding the navigation menu links when the user clicks */
    var navLinks = document.getElementById("navLinks")
    function showMenu(){
        navLinks.style.right = "0";
    }
    function hideMenu(){
        navLinks.style.right = "-200px";
    }

I have been trying to figure out what's wrong for hours help would be much appreciated!


Solution

Replace the event element in your icon oneclick="showMenu" by onclick="showMenu".

For the burger position you can

nav {
    display: flex;
    padding: 2% 6%;
    justify-content: end;
    align-items: center;
}

Should work because your nav panel is on absolute position, but maibe it's better isolate your icon from nav element.



Answered By - Mino mnz
Answer Checked By - Timothy Miller (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Saturday, October 22, 2022

[FIXED] How to format the HTTP response

 October 22, 2022     firefox, google-chrome, http, network-programming, sockets     No comments   

Issue

I have written a socket program in C. I used this program as a chat server/client using TCP. I tried to change the chat server to use it as a HTTP server by changing the port to 80. I referred to the HTTP request/response format in http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Example_session , and made my program to reply with sample response. I tried the url

http://127.0.0.1/ 

in browser. My program read the request and replied with response. At first, I used google-chrome. Chrome didn't load the page correctly until i added the correct data length in Content-Length header. After setting content length header, chrome loaded the page correctly. But, firefox doesn't load the page. Firefox doesn't showed any errors, but still loading the page like it is still waiting for some data. Only When i stop the server or close the socket, complete page is loaded. I tried to follow rfc2616 https://www.rfc-editor.org/rfc/rfc2616 , and made the response exactly , but the still the results are same.

Request:

GET / HTTP/1.1\r\nHost: 127.0.0.1:8080\r\nUser-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:33.0) Gecko/20100101 Firefox/33.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nAccept-Encoding: gzip, deflate\r\nConnection: keep-alive\r\n\r\n

For the above request, my program write to the socket with following response & content.

Response:

HTTP/1.1 200 OK\r\nCache-Control : no-cache, private\r\nContent-Length : 107\r\nDate : Mon, 24 Nov 2014 10:21:21 GMT\r\n\r\n

Content:

<html><head><title></title></head><body>TIME : 1416824843 <br>DATE: Mon Nov 24 15:57:23 2014 </body></html>

This response is loading in Chrome, but not in firefox. Chrome is loading the page instantly whereas firefox is waiting for data. Note that the data length 107 is specified in the header. I donot have any addons enabled in firefox. My firefox version is in the request. Chrome version: Version 38.0.2125.111 (64-bit).

Code:

void *socket_read(void *args)
{
    int socket,*s,length;
    char buf[1024];
    s=(int *)args;
    socket=*s;
    while(1){
        buf[0]='\0';
        length=read(socket,buf,1024);
        if(length==0)
            break;
        else if(length==-1){
            perror("Read");
            return;
        }
        else{
            printf("Request: %s\n",buf);
            send_response(socket);
        }       
    }
    printf("End of read thread [%d]\n",socket);
}
int start_accept(int port)
{
    int socket,csocket;
    pthread_t thread;
    struct sockaddr_in client;
    socklen_t addrlen=sizeof(client);
    pthread_attr_t attr;
    socket=create_socket(port);
    while(1){
        if((csocket=accept(socket,(struct sockaddr *)&client,&addrlen))==-1)
        {   
            perror("Accept");
            break;
        }
        pthread_attr_init(&attr);
        if(0!=pthread_create(&thread,&attr,socket_read,&csocket))
        {
            perror("Read thread");
            return;
        }
        usleep(10000);
    }
}
void send_response(int socket)
{
    char buf1[1024];
    int content_length;
    char buf2[1024]="<html><head><title></title></head><body>TIME : 1416824843 <br>DATE: Mon Nov 24 15:57:23 2014 </body></html>";
    content_length=strlen(buf2);
    sprintf(buf1,"HTTP/1.1 200 OK\r\nCache-Control : no-cache, private\r\nContent-Length : %d\r\nDate : Mon, 24 Nov 2014 12:03:43 GMT\r\n\r\n",content_length);
    printf("Written: %d \n",write(socket,buf1,strlen(buf1)));
    fflush(stdout);
    printf("Written: %d \n",write(socket,buf2,content_length));
    fflush(stdout);
}

Solution

I have found the problem. The Response is incorrect. There should not be any spaces between the header field name and colon(':'). Found this in http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 .

My correct response is

HTTP/1.1 200 OK\r\nCache-Control: no-cache, private\r\nContent-Length: 107\r\nDate: Mon, 24 Nov 2014 10:21:21 GMT\r\n\r\n

I had put a space between 'Content-Length' and ':' . That's the reason Firefox ignored the content length header and reading the socket. Chrome accepted the header fields with spaces, so the problem didn't occurred in chrome.

After removing the space, program works fine.



Answered By - smartkid
Answer Checked By - Timothy Miller (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Sunday, October 16, 2022

[FIXED] Why .txt file in <iframe> is getting downloaded instead of displayed?

 October 16, 2022     download, firefox, html, iframe, struts2     No comments   

Issue

I am using an <iframe> to display a text file:

<div class="document-view">
    <img src="img/302.GIF" />
</div> 

$(window).load(function () {
    <s:if test="extention.equalsIgnoreCase('txt')">
      element = '<iframe class="iframe" src="/dmsrepo/<s:property value="docLocation"/>" />';
    </s:if>

    $('.document-view').html(element);
});

When I inspect element in the browser I can see the file location.

<iframe class="iframe" src="/dmsrepo/Legal Doc Type/LegalDocType_123456789_1.0.txt" />

But the text file is getting downloaded in Chrome, Firefox and IE.

How to resolve this issue?


EDIT: you can reproduce the behavior in the following fiddle, that strangely affects only Firefox, for every page load after the first one.

Simply open the page, then press Run.

Note: it affects also the first load if Firebug Net module is activated.


Solution

This is the issue with the file. it is not formatted as html. because it has some special unicode (eg) characters at end of file read. if text response has special character like that. it failed to parse response as html embedded in iframe.

you can check this example :

<iframe src='http://humanstxt.org/humans.txt' /> </iframe> 



Answered By - Paraneetharan Saravanaperumal
Answer Checked By - Pedro (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] Why firefox console showing unnecessary things

 October 16, 2022     console, firefox, html, javascript     No comments   

Issue

i want just to see the content of the div but firefox is showing me a lot of null and non unnecessary attributes. please help me to hide those attibutes??

enter image description here


Solution

That's part of the page itself. Using Chrome to post, but using Firefox I get that thing on a test website:

What I experienced

On Chrome the same thing happens:

What I experienced on Chrome

Source:

<!DOCTYPE html>
<html>
    <body>
        <div id="this-is-an-id" class="this-is-a-class" custom-attribute="this-is-a-custom-attribute">This is the content of the div</div>
    </body>
</html>


Answered By - softcode
Answer Checked By - Timothy Miller (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to set the background color of Firefox' URL bar with userChrome.css?

 October 16, 2022     css, firefox, userchrome.css     No comments   

Issue

I'm trying to change the background color of my Firefox URL bar using userChrome.css. Following these steps, I added the code below to my userChrome.css (inside <profile>/chrome):

@-moz-document url(chrome://browser/content/browser.xul),
               url(chrome://browser/content/browser.xhtml) {
    #urlbar {
        background-color: red !important;
    }
}

It didn't work at all. How could I get to do it?


Solution

First, you need to set toolkit.legacyUserProfileCustomizations.stylesheets preference to true in about:config, as described here.

Now, the right CSS identifier to be used is #urlbar-background:

@-moz-document url(chrome://browser/content/browser.xul),
               url(chrome://browser/content/browser.xhtml) {
    #urlbar-background{
        background-color: red !important;
    }
}

(I learned that from this file; the whole repository is quite instructive.)



Answered By - brandizzi
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] Why does splinter is_text_present() cause intermittent StaleElementReferenceException with Firefox (but not Chrome or phantomjs)?

 October 16, 2022     firefox, python, selenium, splinter     No comments   

Issue

After upgrading my test environment to the latest versions of selenium, splinter, and Firefox, one of my tests now fails about 80% of the time using Firefox with the following:

Traceback (most recent call last):
  File "/Users/rbednark/Dropbox/git/quizme_website/questions/tests.py", line 103, in test_login_fails_incorrect_username
    "Your username and password didn't match. Please try again."
  File "/Users/rbednark/.virtualenvs/quizme-django-1.6.5/lib/python2.7/site-packages/splinter/driver/webdriver/__init__.py", line 302, in is_text_present
    self.driver.find_element_by_tag_name('body').text.index(text)
  File "/Users/rbednark/.virtualenvs/quizme-django-1.6.5/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py", line 73, in text
    return self._execute(Command.GET_ELEMENT_TEXT)['value']
  File "/Users/rbednark/.virtualenvs/quizme-django-1.6.5/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py", line 494, in _execute
    return self._parent.execute(command, params)
  File "/Users/rbednark/.virtualenvs/quizme-django-1.6.5/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
    self.error_handler.check_response(response)
  File "/Users/rbednark/.virtualenvs/quizme-django-1.6.5/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
    raise exception_class(message, screen, stacktrace)
StaleElementReferenceException: Message: The element reference is stale. Either the element is no longer attached to the DOM or the page has been refreshed.

Note that this same test passes 100% of the time using Chrome and phantomjs. The test:

self.browser.visit(self.live_server_url)
self.assertEquals(self.browser.title, 'Quiz Me!')
self.browser.find_by_id('id_username')[0].fill(user)
self.browser.find_by_id('id_password')[0].fill(password)
# note that the following click() causes a page load
self.browser.find_by_value('login').click()
self.assertTrue(
      self.browser.is_text_present(
          "Your username and password didn't match. "
          "Please try again."
  )
)

firefox upgraded from 49.0.2 to 50.1.0
selenium upgraded from 2.46.0 to 3.0.2
splinter upgraded from 0.6.0 to 0.7.5
geckodriver 0.13.0
(the above are all the latest versions at the time this was posted)


Solution

I solved my problem by implementing this wrapper that retries when the exception is caught:

from selenium.common.exceptions import StaleElementReferenceException

def _loop_is_text_present(text, max_attempts=3):
    attempt = 1
    while True:
        try:
            return self.browser.is_text_present(text)
        except StaleElementReferenceException:
            if attempt == max_attempts:
                raise
            attempt += 1

Inspired by: http://darrellgrainger.blogspot.com/2012/06/staleelementexception.html

Selenium source code that describes the StaleElementReferenceException.



Answered By - Rob Bednark
Answer Checked By - Marilyn (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] What is the alternate for -webkit-print-color-adjust in firefox and IE

 October 16, 2022     css, firefox, google-chrome, internet-explorer     No comments   

Issue

I had some issues with the printing the background colors.

print-color-adjust made the background color issue solved in chrome.

body{
-webkit-print-color-adjust: exact;
}

What are the alternate CSS in firefox and IE for this.


Solution

As mentioned -webkit-print-color-adjust: exact is specific to WebKit browsers, including Google's Chrome and Apple's Safari; therefore the code should work adequately in those aforementioned browsers with perhaps slightly varied results (depending on your site/app styling).

There have been proposals to standardize this snippet to work universally for not just browsers but for different devices too. The code is simplified to: color-adjust. Similarly to the webkit-print-color-adjust property, the possible values are the same for the proposed property economy | exact.

If you want to use the property for printing purposes, simply use within a selector inside a @media print query.

For example:

@media print {
  body { color-adjust: exact; }
}

I cannot guarantee the widespread adoption on browsers for the drafted property, however it is currently working on the latest version of FireFox (at the time of writing, version 50.0).

[Source]



Answered By - aullah
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How do I block or substitute a certain font in Firefox?

 October 16, 2022     firefox, fonts     No comments   

Issue

I have Helvetica installed on my Windows XP PC, which is great for designing, but Helvetica looks horrendous when displayed in a browser on PC.

For example, I visit a website with this style:

font-family: Helvetica, Arial, sans-serif;

Helvetica is selected, as it is installed on my system.

Can I force Firefox to pretend Helvetica isn't installed on my system, and render these pages using Arial?


Solution

The other day I came across a site that used Comic Sans, and I decided I wanted to replace it with Verdana. I did some googling and found this Greasemonkey script which removes Comic Sans from any website you visit. I rewrote that script to replace Helvetica with Arial

var tags = document.getElementsByTagName('*');
for (var i in tags) {
    var style = getComputedStyle(tags[i], '');
    if (style.fontFamily.match(/helvetica/i)) {
        var fonts = style.fontFamily.split(',');
        for (var j in fonts) {
            if (fonts[j].match(/helvetica/i)) {
                fonts[j] = 'arial';
            }
        }
        tags[i].style.fontFamily = fonts.join(',');
    }
}


Answered By - Rob
Answer Checked By - Mary Flores (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to access the subdomain of an IP address in the browser?

 October 16, 2022     browser, firefox, ip, ip-address, web     No comments   

Issue

To get to the IP address of an example website, you just visit

subdomain.example.com

However, if I try to visit

subdomain.2.1.33.111 (example ip)

Firefox returns an error.
Why?


Solution

All browsers will return an error for this. The reason is that subdomains are part of the DNS (Domain Name Service) system, where IP addresses are related to the underlying IP protocol.

The best way to think of this relationship is that domains (including subdomains) are human-readable labels which DNS then allows you to point to IP addresses. It would not be very catchy to have an IP address as your website on a TV ad, for example.

There is much more detail on DNS and IP addresses if you want to delve into more detail than this.



Answered By - Chris Alexander
Answer Checked By - Senaida (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] Why aren't my overflow and display properties working in Firefox and Chrome?

 October 16, 2022     css, firefox, google-chrome     No comments   

Issue

I have in my CSS this class:

.middleContent { overflow: hidden; display:inline-block; }

This works in IE but not in Firefox or Chrome so I wanted to do a sanity check here because I am not sure how to write this and might need direction.

To leave it working in IE, I left the above line:

.middleContent { overflow: hidden; display:inline-block; }

So for Firefox and Chrome, do I add the following lines like this:

For Firefox:

@-moz-document url-prefix() { 
     .middleContent { overflow: hidden; }
}

For Chrome:

@media screen and (-webkit-min-device-pixel-ratio:0) {
    .middleContent { overflow: hidden; }
}

Solution

Yes, you are correct. To Target Chrome :

@media screen and (-webkit-min-device-pixel-ratio:0) { 
 div{top:0;} 
}

To Target any firefox:

@-moz-document url-prefix() { 
      .selector {
         color:lime;
      }
    }


Answered By - yardie
Answer Checked By - Terry (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to make my browser (such as Firefox) open a custom File Manager?

 October 16, 2022     explorer, firefox, regedit     No comments   

Issue

My system is Windows 11 build 22621. Now I use Tablacus Explorer to manage my files instead of Explorer.exe, however, many apps (such as Firefox or Control Panel) will still use Explorer.exe when I try to open directory or other something in those apps,even though I used some Tablacus's plugins such as Shell Execute Hook. Are there better methods to let other apps to auto open Tablacus as more as possible?


Solution

Add "Open Instead" and "System Tray" plugin to solve the problem.



Answered By - forestbat
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] Where are Firefox IndexedDB files stored?

 October 16, 2022     firefox, firefox4, html, windows-7     No comments   

Issue

If I create an IndexedDB in Firefox 4, where are the files stored on my hard drive? Preferably for Win7, but the path is probably similar across OSes.


Solution

This post suggests the following location:

C:\Documents and Settings\<username>\Application 
Data\Mozilla\Firefox\Profiles\<xxxx>.default\indexedDB\<databaseid>

The <xxxx>.default folder is your profile directory, which is where Firefox keeps basically everything.



Answered By - Wayne
Answer Checked By - David Goodson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How can I use an HTTPS client certificate protected api with Firefox

 October 16, 2022     client-certificates, firefox, https, security     No comments   

Issue

I have protected my staging environment with an HTTPS client certificate. The site consists of multiple subdomains rest.site.com, files.site.com, site.com, etc.
Everyone has the same certificate.
The problem is that firefox doesn't send a client certificate with cors preflight requests. Which means those request will inevitably always fail and so firefox refuses to access the api at all.
So is there a way to force firefox to send the certificate with the preflight request?


Solution

  1. type into the url bar about:config
  2. find network.cors_preflight.allow_client_cert
  3. set to true

client certs will now be sent with preflight requests



Answered By - user2741831
Answer Checked By - Marie Seifert (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How do you enable :has() selector on Firefox

 October 16, 2022     css, css-selectors, firefox, settings     No comments   

Issue

When I check the :has() css selector on caniuse.com, it tells me that since Firefox103 it has been "Supported in Firefox behind the layout.css.has-selector.enabled flag". So how do I find this flag and enable it?


Solution

Go to the Firefox about:config page, then search and toggle layout.css.has-selector.enabled.

enter image description here



Answered By - Cédric
Answer Checked By - Terry (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to get through security error pages in firefox browser?

 October 16, 2022     browser, firefox, google-chrome     No comments   

Issue

I'm aware that we use thisisunsafe in Chrome to bypass such error pages but how can I bypass such pages in Firefox? I get the following error when I load the page:-

Firefox detected a potential security threat and did not continue to <site> because this website requires a secure connection.

<site> has a security policy called HTTP Strict Transport Security (HSTS), which means that Firefox can only connect to it securely. You can’t add an exception to visit this site.

I tried the following steps to resolve it but it didn't solve the issue:-

  1. Opened a new tab and entered about:config
  2. Clicked on Accept the Risk and Continue
  3. In the search field, type in security.enterprise_roots.enabled and hit enter
  4. I saw one field which was already enabled true
  5. Didn't know what to do next as the field was already enabled true

I'm looking for a workaround of thisisunsafe in Firefox.


Solution

  1. In the Mozilla Firefox address bar, type about:config
  2. Look for network.stricttransportsecurity.preloadlist
  3. And set the last field Value to false and restart the browser.


Answered By - Neha Chaudhary
Answer Checked By - Clifford M. (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to access firefox web console command history?

 October 16, 2022     firefox, google-chrome     No comments   

Issue

It is fairly easy to access the last 30 (!) javascript console commands in Google Chrome devtools:

Undock devtools and press Ctrl+Shift+I in it to inspect devtools itself.

In that new devtools window, type following commands in the console:

> location.origin
"chrome-devtools://devtools"
> JSON.parse(localStorage.consoleHistory).join('\n')
"inp.style.backgroundColor = "rgb(250, 0, 250)"
inp.style.backgroundColor = "rgb(250, 255, 250)"
...
inp.style.backgroundSize
inp.style.backgroundColor"
> JSON.parse(localStorage.consoleHistory).length
30

How can I do the equivalent in Firefox?

I wouldn't mind if it had a longer command history than google chrome.

That pastebin answer was only good for a day. So here it is again, thanks @msucan!

function getWebConsolePanel(tab) {
    var gDevTools = Cu.import("resource:///modules/devtools/gDevTools.jsm", {})\
.gDevTools;
    var tools = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).dev\
tools;
    var target = tools.TargetFactory.forTab(tab || gBrowser.selectedTab);
    var toolbox = gDevTools.getToolbox(target);
    var panel = toolbox.getPanel("webconsole");
    return panel;
}

getWebConsolePanel();

Solution

  1. Press F12 to open the developer toolbox (eg. the web console), then
  2. Switch to the Options panel.
  3. Enable chrome debugging.
  4. Open Scratchpad (Shift-F4).
  5. Copy/paste this code: https://pastebin.mozilla.org/3757211
  6. Go to Environment > Browser.
  7. Pick Execute > Display or Inspect.

And now you will see the web console history for the currently selected tab.



Answered By - msucan
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to stop user agent stylesheets from overriding my css

 October 16, 2022     css, firefox, google-chrome     No comments   

Issue

I'm trying to set cursor: pointer on a dom element, but the input isn't taking it (I am not seeing a pointer cursor when I hover over the checkbox). In chrome, I see that the "user agent stylesheet" is overriding my css. Wtf?

<!doctype html>
<body>
    <div class='a'>
        <input type='checkbox'>
    </div>

    <style>
        .a {
            cursor: pointer;
        }
    </style>
</body>

I have seen this question: Why does user agent stylesheet override my styles? But my problem does not seem to be the doctype, which is the recommended doctype.

Using !important isn't acceptable here, and neither is styling the input node directly - I shouldn't have to worry about weird browser useragent styles. What's going on?

To clarify, my question is about why the user agent stylesheet is overriding the css and how to make that stop. My question is not how I can hack around this behavior. If I'm not mistaken, the correct behavior of css is that the cursor style should be inherited by child nodes.

Is this the expected behavior of css?


Solution

The "problem" here is that there is actually no input style in the author stylesheet (see the spec for more info), and therefore the style that is defined in the user agent stylesheet is used.

The (relevant) user agent rule (on chrome) is:

input, input[type="password"], input[type="search"] {
   cursor: auto;
}

You can achieve what you want in a couple ways:

  1. Create a css class that selects the input directly, for example
    • using another css class, or
    • selecting the input within the already-defined class,
    • etc
  2. Explicitly setting inheritance behavior for the cursor style on all inputs

For (1):

<style>
  .a, .a input {
      cursor: pointer;
  }
</style>

For (2):

<style>
  input {
      cursor: inherit;
  }
  .a {
      cursor: pointer;
  }
</style>


Answered By - Beterraba
Answer Checked By - Timothy Miller (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How can I run fIrefox from within a docker container

 October 16, 2022     docker, firefox, x11     No comments   

Issue

I'm trying to create a docker container that will let me run firefox, so I can eventually use a jupyter notebook. Right now, although I have successfully installed firefox, I cannot get a window to open.

Following instructions from running-gui-apps-within-docker, I created an image (i.e. "sample") with Firefox and then tried to run it using

$ docker run -it --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --net=host sample

When I did so, I got the following error:

root@machine:~# firefox
No protocol specified
Unable to init server: Could not connect: Connection refused
Error: cannot open display: :1

Using man docker run to understand the flags, I was not able to find the --net flag, though I did see a --network flag. However, replacing --net with --network didn't change anything. How do I specify a protocol, that will let me create an image from whose containers I will be able to run firefox?

PS - For what it's worth, when I check the value of DISPLAY, I get the predictable:

~# echo $DISPLAY
:1

Solution

I have been running firefox inside docker for quite some time so this is possible. With regards to the security aspects I think the following is the relevant parts:

Building

The build needs to match up uid/gid values with the user that is running the container. I do this with UID and GID build args:

Dockerfile

...
FROM fedora:35 as runtime

ENV DISPLAY=:0

# uid and gid in container needs to match host owner of
# /tmp/.docker.xauth, so they must be passed as build arguments.
ARG UID
ARG GID

RUN \
       groupadd -g ${GID} firefox && \
       useradd --create-home --uid ${UID} --gid ${GID} --comment="Firefox User" firefox && \
       true
...

ENTRYPOINT [ "/entrypoint.sh" ]

Makefile

build:
        docker pull $$(awk '/^FROM/{print $$2}' Dockerfile | sort -u)
        docker build \
                -t $(USER)/firefox:latest \
                -t $(USER)/firefox:`date +%Y-%m-%d_%H-%M` \
                --build-arg UID=`id -u` \
                --build-arg GID=`id -g` \
                .

entrypoint.sh

#!/bin/sh

# Assumes you have run
#      pactl load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1
# on the host system.
PULSE_SERVER=tcp:127.0.0.1:4713
export PULSE_SERVER

if [ "$1" = /bin/bash ]
then
        exec "$@"
fi

exec /usr/local/bin/su-exec firefox:firefox \
        /usr/bin/xterm \
                -geometry 160x15 \
                /usr/bin/firefox --no-remote "$@"

So I am running firefox as a dedicated non-root user, and I wrap it via xterm so that the container does not die if firefox accidentally exit or if you want to restart. It is a bit annoying having all these extra xterm windows, but I have not found any other way in preventing accidental loss of the .mozilla directory content (mapping out to a volume would prevent running multiple independent docker instances which I definitely want, and also from a privacy point of view not dragging along a long history is something I want. Whenever I do want to save something I make a copy of the .mozilla directory and save it on the host computer (and restore later in a new container)).

Running

run.sh

#!/bin/bash

export XSOCK=/tmp/.X11-unix
export XAUTH=/tmp/.docker.xauth

touch ${XAUTH}
xauth nlist ${DISPLAY} | sed -e 's/^..../ffff/' | uniq | xauth -f ${XAUTH} nmerge -

DISPLAY2=$(echo $DISPLAY | sed s/localhost//)
if [ $DISPLAY2 != $DISPLAY ]
then
        export DISPLAY=$DISPLAY2
        xauth nlist ${DISPLAY} | sed -e 's/^..../ffff/' | uniq | xauth -f ${XAUTH} nmerge -
fi

ARGS=$(echo $@ | sed 's/[^a-zA-Z0-9_.-]//g')

docker run -ti --rm \
        --user root \
        --name firefox-"$ARGS" \
        --network=host \
        --memory "16g" --shm-size "1g" \
        --mount "type=bind,target=/home/firefox/Downloads,src=$HOME/firefox_downloads" \
        -v ${XSOCK}:${XSOCK} \
        -v ${XAUTH}:${XAUTH} \
        -e XAUTHORITY=${XAUTH} \
        -e DISPLAY=${DISPLAY} \
        ${USER}/firefox "$@"

With this you can for instance run ./run.sh https://stackoverflow.com/ and get a container named firefox-httpsstackoverflow.com. If you then want to log into your bank completely isolated from all other firefox instances (protected by operating system process boundaries, not just some internal browser separation) you run ./run.sh https://yourbank.example.com/.



Answered By - hlovdal
Answer Checked By - Pedro (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How do I remove the X buttons in Firefox?

 October 16, 2022     browser, firefox     No comments   

Issue

I went to my profile settings and added a folder called 'chrome' and a file called userChrome.css.

I included this code:

@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */

#tabbrowser-tabs .tabbrowser-tab .tab-close-button { display:none!important; }

I restarted my Firefox instance and it still shows the X close button in the tabs.


Solution

Note: Firefox 69 and new versions will not support userChrome.css and userContent.css by default unless preference is set by the user.

To use userChrome.css follow below steps:

  • First type about:config in url/address bar
  • Then search for the property named toolkit.legacyUserProfileCustomizations.stylesheets
  • Set it to True and restart firefox


Answered By - deadshot
Answer Checked By - David Goodson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing