html

How can I prevent jank and reduce layout shift with responsive sized images?

北慕城南 提交于 2021-02-20 10:15:33
问题 My website hosts a lot of images of all sizes. These images are responsive and change size at all browser widths from desktop to mobile. I see in my Google Search Console that I have a poor CLS (cumulative layout shift) of .25s. The layout of my website shifts as the images load. Since my images are responsive, I can't specify exact sizes of the images, or have placeholders to reserve the space. What is a modern way to prevent CLS with responsive images? Layout here: https://jsfiddle.net

JWT-based authentication for <img> tags?

自作多情 提交于 2021-02-20 06:49:31
问题 Supposed I have a single page application that uses JWT tokens to authenticate against a backend REST api. I transfer the JWT token inside the http header when doing a REST request. So far, so good. Now, supposed I want to download an image from the server, and I want the image only to be accessible for authenticated users. On the server, this is no problem: Simply define a route that delivers the image, and in that route verify the JWT token. But: How do I transfer the token from the client

JWT-based authentication for <img> tags?

我怕爱的太早我们不能终老 提交于 2021-02-20 06:45:13
问题 Supposed I have a single page application that uses JWT tokens to authenticate against a backend REST api. I transfer the JWT token inside the http header when doing a REST request. So far, so good. Now, supposed I want to download an image from the server, and I want the image only to be accessible for authenticated users. On the server, this is no problem: Simply define a route that delivers the image, and in that route verify the JWT token. But: How do I transfer the token from the client

How to extract data from HTML page source of (a tab within) a webpage?

五迷三道 提交于 2021-02-20 06:21:10
问题 I have tried several solutions specified in other answers, like experimenting with different user agents (Chrome, safari etc), and getting HTML directly using HTTPClient and BufferedReader, but none of them work. How do I make the Android output similar as a web output? Here is the web output I am looking for; (View page source of https://finance.yahoo.com/quote/AAPL/financials?p=AAPL for full output - this basically contains the AJAX tab named "Quarterly" which contains a table . I need to

How to extract data from HTML page source of (a tab within) a webpage?

依然范特西╮ 提交于 2021-02-20 06:20:34
问题 I have tried several solutions specified in other answers, like experimenting with different user agents (Chrome, safari etc), and getting HTML directly using HTTPClient and BufferedReader, but none of them work. How do I make the Android output similar as a web output? Here is the web output I am looking for; (View page source of https://finance.yahoo.com/quote/AAPL/financials?p=AAPL for full output - this basically contains the AJAX tab named "Quarterly" which contains a table . I need to

Div odd and even

一曲冷凌霜 提交于 2021-02-20 05:53:40
问题 I have a problem that i believe to have a simple fix I just don't know the fix myself. Say i have some divs i.e. <div class="box-1"></div> <div class="box-2"></div> <div class="box-3"></div> <div class="box-4"></div> etc. If these boxes need to be alternate colours. I need to create some css which basically does the following: .box-(odd-number) { color:#000; } .box-(even-number) { color:#fff; } Obviously I know the above is not the correct syntax. Could some one point me in the right

How to specify language of website? (HTML?)

房东的猫 提交于 2021-02-20 05:47:47
问题 How do I specify that a page is in a certain language so search engines can understand? Is it a meta tag I put at the top? If it is, do you know if most of the search engines use this to determine language? I have converted 1 page of content in english to several different languages, and would like to include that information in the html/let the search engines know which language they are dealing with. 回答1: Quick google search gave me this: HTTP and meta for language. tl;dr <html lang="en">

Find a tag using text it contains using BeautifulSoup

荒凉一梦 提交于 2021-02-20 05:16:37
问题 I am trying to webscrape some parts of this page: https://markets.businessinsider.com/stocks/bp-stock using BeautifulSoup to search for some text contained in h2 title of tables when i do: data_table = soup.find('h2', text=re.compile('RELATED STOCKS')).find_parent('div').find('table') It correctly get the table I am after. When I try to get the table "Analyst Opinion" using the similar line, it returns None: data_table = soup.find('h2', text=re.compile('ANALYST OPINIONS')).find_parent('div')

jQuery Select box multiple option get value and match values

左心房为你撑大大i 提交于 2021-02-20 05:16:31
问题 I have same classname multi select box with same values in body, what I want if use chose value 1 from first or any select box then that value 1 on all other select box option will disable so user can't choose the same value in other multi select box. <select name="mySel" class="myselect" multiple="multiple"> <option value="val1">option 1</option> <option value="val2">option 2</option> <option value="val3">option 3</option> <option value="val4">option 4</option> </select> <select name="mySel"

jQuery Select box multiple option get value and match values

走远了吗. 提交于 2021-02-20 05:16:07
问题 I have same classname multi select box with same values in body, what I want if use chose value 1 from first or any select box then that value 1 on all other select box option will disable so user can't choose the same value in other multi select box. <select name="mySel" class="myselect" multiple="multiple"> <option value="val1">option 1</option> <option value="val2">option 2</option> <option value="val3">option 3</option> <option value="val4">option 4</option> </select> <select name="mySel"