What is the purpose of utilizing jQuery for retrieving CSS resources?

Upon reviewing the Chrome Dev Tools screenshot, I am puzzled by the fact that my CSS assets are being fetched by jQuery. The CSS sheet is included in the normal way, using a

<link rel="stylesheet">
tag in the <head> section, while jQuery and jQueryUI are included at the end of the body.

On inspecting line 6128, I encountered the function curCSS, which seems to be utilized by jQueryUI despite being deprecated.

jQuery         v1.11.1
Google Chrome  v39.0.2171.65 (64-bit)

EDIT1:

I would like to clarify that these assets are not actually utilized by jQueryUI, but rather consist of background images and fonts for my content.


EDIT2:

After commenting out jQueryUI and refreshing the page (Ctrl+F5), the assets continue to be loaded by something on line 3580.

**jQuery.js snippet removed for brevity**

Furthermore, when I also comment out jQuery, the assets load as expected.


EDIT3:

To explain why only jQuery + UI were loaded without any other scripts:
I initially included jQuery + UI in my base template, and upon loading another page that did not require jQuery at all, I noticed unusual behavior from jQuery during debugging.

The markup involved was kept minimal:

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Pagetitle</title>

    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"/>

    <link rel="stylesheet" href="css/jquery-ui.min.css"/>
    <link rel="stylesheet" href="css/fonts.css"/>
    <link rel="stylesheet" href="css/style.css"/>
</head>
<body>
    <div style="font-family: ArialNarrowBold">CONTENT</div>

    <script type="text/javascript" src="js/jquery/jquery.js"></script>
    <script type="text/javascript" src="js/jquery/jquery-ui.js"></script>
</body>
</html>

Subsequently, the Chrome dev-tools display the following:

The font ArialNarrowBold is located in fonts.css. Despite having no additional scripting on the page apart from jQuery and jQuery-UI inclusion, jQuery continues to attempt to load it independently even if jquery-ui.min.css is excluded.

Even after relocating the font-loading to a style block, jQuery persists in attempting to fetch it autonomously.

<style type="text/css">
    @font-face {
        font-family: 'ArialNarrowBold';
        src: url('fonts/ArialNarrowBold.eot');
        src: url('fonts/ArialNarrowBold.eot?#iefix') format('embedded-opentype'),
             url('fonts/ArialNarrowBold.woff') format('woff'),
             url('fonts/ArialNarrowBold.ttf') format('truetype');
        font-weight: normal;
        font-style: normal;
    }
</style>

Answer №1

It appears that there may be a regression in Chrome Devtools based on my testing. After checking with both Chrome Canary and Chromium, I was unable to reproduce the issue on either browser. It would be beneficial for you to report this problem: https://support.google.com/chrome/answer/95315?hl=en

Before submitting the bug report, make sure you are using the latest version of Chrome and see if that resolves the issue.

Answer №2

When utilizing jquery to include an image src attribute, I am experiencing the same issue. If you take note of the column labeled "Initiator":

It appears that Chrome tracks in that column the script responsible for initiating the request. Perhaps you are loading some html using jquery that contains embedded css, or any asset not linked with css.

For instance:

$(img).attr('src', 'image.png');

//OR
$(div).load('/load/index.html');

This will result in similar information being displayed on the chrome console.

Answer №3

For optimal performance, attempt accessing the site through Firefox and analyze its behavior. If you encounter any mention of "jQuery", it may signify a critical issue. However, if the message is "nothing", it could indicate a problem specific to Chrome. Remember to document the issue!

Answer №4

Do you have jQuery implemented on your website? It seems necessary if you are loading it.

Make sure to provide all the relevant markup, especially any jQuery code (inline or in script tags).

  • Are you sending AJAX requests? Sometimes responses can cause issues like this.

  • Have you considered using AJAX JSONP?

  • Is Ruby a part of your tech stack?

    • If it is, are you utilizing .js.erb files? I've encountered situations where JavaScript returned from .js.erb files through AJAX calls gets injected directly into the page and executed.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What are some creative ways to design the selected tab?

In my Vue parent component, I have multiple child components. There are several elements that toggle between components by updating the current data. The issue is that I am unsure how to indicate which tab is currently active. I've tried various li ...

Setting the variable to global does not apply styling to the element

Looking for help with styling an element created using document.createElement("img")? let fireball; //global variable fireball = document.createElement("img") //variable on local fireballArray.push(someFunction(fireball, { src: "img.png&qu ...

What are the limitations on cross-site scripting for local (file:///) pages?

I am currently working on an HTML/Javascript application that makes use of jQuery to communicate with a web server that I unfortunately do not have control over. The application runs smoothly when accessed locally through the file:///app.html URL on Safari ...

Can I use javascript/jquery to alter the direction of text in each line?

Looking for assistance with changing text direction on each new line. For instance: text left-to-right text right-to-left text left-to-right text right-to-left... etc. I would like the text direction to change with each word-wrap: break-word. Any help w ...

Creating a dynamic Y-axis interval in Echarts is a straightforward process that can greatly enhance the

Can echarts be used to create a dynamic Y-axis interval? The goal is to achieve the following Y-axis interval in the provided table: +---------------+--------------+ | Description | Percentage | +---------------+--------------+ | Exceptional.. | 98% a ...

Issue in IE with click event not firing from parent page

Currently, I am facing an issue with a filter on one of my website's pages that is designed to display various products. My goal is to set it up so that when a button from an external page is clicked, the user will be redirected to the product page wh ...

Incorporating a PHP line into a CSS file that is dynamically generated by PHP code

Struggling with adding a get_template_directory_uri() in a CSS line located in a boxes.php file. $box_first = 'linear-gradient(rgba(0, 175, 227, .8), rgba(0, 175, 227, .8)), url("/wp/wp-content/themes/my_theme/inc/img/boxes/box2.png") center ...

Uncover the secrets of HTML with JavaScript

I'm facing an issue with extracting data from a link's data attribute and trying to decode the HTML within it, but unfortunately, it's not functioning as expected. Check out my code on JSFiddle: http://jsfiddle.net/Kd25m/1/ Here's the ...

Having trouble retrieving information from the server using ajax, javascript, jquery, and php

I am currently facing an issue with sending data retrieved from a jQuery call and attempting to save it to a server file using PHP. function getSVG(){ svghead = svghead + $('#test').html(); $.ajax({ type:"POST", da ...

Aligning divs, prevent duplicate HTML within multiple divs

Currently, I am attempting to troubleshoot a jsfiddle issue. The main problem lies in my desire for the first two divs (with class="fbox") to be aligned next to each other on the same level. Furthermore, I am looking to enable dragging the image into the ...

Guide to setting the hiddenfield value within a listview using javascript or jquery

Here is the javascript code that I am using to retrieve the value from my textbox with autocompleteextender. <script type="text/javascript"> function txt_lect_in_AutoCompleteExtender_itemSelected(sender, e) { var hdEmpId = $get('& ...

Exploring the process of adding arrays to highcharts using jQuery

All my coding work has been carried out on FIDDLE I have carefully monitored all the arrays: MARKET[0], MARKET[1], MARKET[2], MARKET[3], MARKET[4], MARKET[5], MARKET[6], MARKET[7]. They display correctly in alerts. However, when I attempted to incorporate ...

Is there a way to include the site_path define('SITE_PATH','http://127.0.0.1/project/'); in a jQuery URL?

Looking for help with my jQuery Ajax code jQuery.ajax({ url:'login.php', }); I am trying to figure out how to add a site path in the url like we define a site path in PHP using define('SITE_PATH','http://127.0.0.1/project/&apos ...

What are the steps to making a textfield editable with JavaScript and HTML?

My textfield is currently populated with values from the database and is functioning perfectly. I would like to implement a checkbox feature that, when clicked, will clear the textfield of the database values, allowing the user to input new values. If t ...

Trimmed scrollbar and border in Webkit

There seems to be some clipping on the scrollbar and border of the textarea: <!DOCTYPE html> <html> <head> <meta charset="UTF-8> <title>Scrollbar and Border Clipping Issue in Webkit</title> <style> ...

"Exploring the best way to loop through multiple JSON data in a jQuery response

https://i.stack.imgur.com/O0F6g.pngMy JSON response contains multiple data points presented as follows. WellNames […] 0 {…} id 56 well_name AL HALL api 34005205550000 1 {…} id 498 well_name BONTRAGER api 34005233850000 2 {…} id 499 ...

What is the best way to acquire an ID that is generated dynamically?

Being new to javascript and ajax, I am facing a challenge. I have a while loop with 2 buttons, both of which seem to function correctly, except for one small issue... The product-id is only being passed for the first or last element in the loop. How can I ...

analyzing strings by comparing their characters to another string

In a scenario where I have two strings; let's call them string a="a-b-c" and string b="a-b". I am looking to determine whether every letter in string b is present within string a. ...

Other options for positioning background in SVG or using CSS within SVG could include center center alignment settings

I am currently developing a website where I have a div covered by an SVG. When I use this SVG as a background image and apply background-position: center center, it functions as expected. However, my issue arises when I try to add additional CSS in this ma ...

The navigation bar extends beyond the page's width

Currently, I am working on a website that was started by a former colleague. One issue I have noticed is that when the browser window's resolution reaches 768px or lower, the navigation transforms into a drop-down menu that appears wider than the page ...