Detecting where a file is being loaded? - javascript

I'm taking on a site build in WordPress and I did a few scans through it, one with SEMRush.
It this results in a mixed content issue with the culprit being a reference to http://www.29wp.org/jquery.js.
The issue is, when I view page source and inspect it, it's not there.
It's as if this is being loaded and removed somehow, but doing a grep results in nothing.
I checked the usual places for where this was loaded, and eventually checked the network tab in chrome inspector -- nothing there that looks like this file.
I did a scan on all the site files -- nothing shown.
I then did a search in the DB - still nothing.
Any others ways you can think of for finding where this is being loaded?
Thanks

Check if there are CURL requests in any of your Wordpress php files , If you found curl_init() or any other curl function that you don't know anything about , Then that might be the reason.
Note "This is how latest web malwares work" .

Related

JQuery "load" worked in Bracket's Live Preview, but not when uploaded to server

I am working on a website in which I want to load web pages through Jquery's .load function as a part of an overlay type of navigation. I use Brackets to code and its Live Preview function has proven to be very useful.
While developing I already noticed that the load function only worked in the Live Preview mode, and not if I open the page in a regular browser window, so I assumed that Live Preview emulates a server in some way and that's why it worked.
However, when I uploaded my files to the server through the MODx content management system that I use, the function seems to have stopped working.
For the sake of completion, here's the code snippet that I use:
{$( ".div" ).load( "page.html" );
Can anybody tell me why this is happening? I've read some stuff about security protocol issues with .load, but since all files are on the same server I don't think that's the issue. Don't take my word for it, though. I'm a designer first and a developer... third or fourth, probably.
EDIT: The console gives me a 404 error.
Thank you for taking the time to read this!
Kind regards

jquery conflict with my website

I layout'd a page and on my server which is it hostgator works extremely fine, using the jQuery mobile components:
http://brunolustro.com/roger/teste/cadastro.html
But my friend who is programming the page wanted me to insert the newest CDNs from either jQuery and jQuery Mobile:
And this is what the page looks like when I insert those codes:
http://brunolustro.com/roger/test/cadastro.html
Do you know how to fix this?
Regards,
Bruno
When working with JavaScript or jQuery on your website - if something isn't working as you intend - the first thing you should do is check the browser console to see if anything is being logged there.
To check the browser console:
Hit F12 on your keyboard. When the developer tools open, choose the console tab, its placed in the toolbar at the top of the new window.
In the console you will see a few errors in red with error codes (404). A 404 means the requested file wasn't found.
This tells us that your reference to jQuery isn't correct. This could be because the file path you've written isn't correct, or that you haven't deployed those files correctly to your site.
Check your file paths you've referenced and make sure the file is on your server. Once both are correct - the errors should go away.
Here's a link to view more about developer tools: https://developer.chrome.com/devtools#console
Check following files in your "test/js" and "teste/js" folders, because i've got 404 not found error:
jquery-2.0.3.min.js
modernizr-2.6.2.min.js
jquery.mobile-1.4.5.min.map

Javascript in asp.net MVC... Beginner issue

I created an Asp.Net MVC Internet Aplication and in my Index view of the Home Controller I have this
This is the first line, before the script results.
<script type="text/javascript" src="~/Script/Teste.js"></script>
<br />
This line comes after the script.
In my Teste.js I have this:
document.write("Yes! I am now a JavaScript coder!");
But nothing happens. If I change the src attribute and put some random name src="aaaa", despite the fact "aaaa" doesnt exist, I get no error in runtime.
EDIT
Also, check your path again. The default MVC templates in VS create a folder called Scripts, not Script. ("~/Scripts/teste.js")
Per the comment below, this was not the root cause of the issue, but in other cases can easily bite new JavaScript developers.
Most likely, your document.write function is firing before the document is ready, leading to the appearance that nothing is happening. Try the following in your Teste.js file
window.onload = function ()
{
document.write("Yes! I am now a JavaScript coder!");
//or even better as a test
alert("This alert was called");
}
Check the source of your page as well, it could be the document is being written to, you just can't see it due to markup/page styling.
As for you second issue, there will be no 'Runtime Exception' thrown if you reference a non-existent file. If you are using tools like Firebug or Chrome's developer tools, you should see a request to http://siteDomain/Scripts/aaaa.js with a response of 404, not found.
You generally should avoid using document.write() unless you absolutely have to use it for some reason... I don't think I've ever come across such a situation, and write a lot of Javascript.
Try this:
1) Put this in your HTML:
<script src="/scripts/teste.js"></script>
2) Put this in your JS:
alert('Yes! I am now a JavaScript coder!');
3) Open Chrome since it makes it easy to look for external resources loading and open the Network tab in Developer Tools (click the menu button at top-right, Tools > Developer Tools, Network tab).
4) Run your project and copy/paste the URL in the browser that comes up into this Chrome window, and hit enter.
When your page loads one of 2 things will happen:
A) You'll get the alert box you wanted or
B) You'll find out why it isn't loading because the Network tab will show the browser attempting to fetch teste.js and failing in some fashion, for example a 404, which would indicate you've got a typo in the path, or the script isn't where you thought it was, etc.
Put the following line at the very end of your document. There should not be anything after. Then try to load the page.
<script type="text/javascript" src="~/Script/Teste.js"></script>
Also, try pressing F12 once the page loads to see the source. Check if you script is there.
In MVC, the tilde is used to refer to the root URL of your application. However, it cannot normally parse this information. If you write:
<script src="~/Script/Teste.js"></script>
The lookup will fail, because the ~ means nothing special in HTML. If you're using Razor as your view engine (not ASPX), you need to wrap that call in Url.Content like so:
<script src="#Url.Content(~/Script/Teste.js)"></script>
Doing this will ensure a valid URL is provided to the browser.
With that in mind, you need to check that you have the file name and folder name both correct. You also need to ensure that the file is being deployed with your application. You can do this my opening the properties panel while the file is selected in the Solution Explorer and pressing F4.

javascript reloading page: how to find the culprit

I have a page that is being continually reloaded, about every 45 seconds. If I disable javascript in the browser, the page stops reloading - so I suspect that some javascript is the culprit. But there's a large amount of it scattered across various .js files, some of them compressed. So I'm having a hard time poring thru the JS source trying to find the culprit.
I'm looking for ideas on how to find the cause - without reading (and understanding) all of the JS source.
I've tried using Break on Next in Firebug. It always breaks inside of jquery.min.js - but there's no history in the stack, so I can't tell who called jQuery.
The web page is http://www.sarasotasailingsquadron.org/
Other ideas?
Alright, so I have found part of your problem. I can't quite find where it originates, but maybe this will help you.
I haven't been able to completely reproduce your issue under Chrome, but every minute or so, I do see a request for your home page. According to Chrome's developer tools, that request is initiating within jQuery. (That doesn't mean jQuery is the culprit... that just means that whatever code is making the request is using jQuery to do it.)
In the console, there is a suspicious error message:
Resource interpreted as Image but transferred with MIME type text/html: "http://www.sarasotasailingsquadron.org/".
The call stack drops it down to $.transition. It seems that this has to do with your image transition header, "coin slider".
I've skimmed your code and don't see the reference, but somewhere I suspect you are trying to load your home page as an image in that header. Maybe you have some invalid HTML or a null URL to the image keeping it from populating the full request URL or something. In any case, this should help you track down the exact source.

page area not refreshing using jquery and setinterval

i am trying to refresh a particular area of my php page, which will load the updated information from database. My code are working on localhost. But, when the same code i'm trying to execute on my domain. Then, it is not refreshing and not showing updated information, and i don't why... Anybody have any idea..
setInterval(updateShouts, 10000 );
function updateShouts(){
$('#refresh').load('ajax/check.php');
};
this is the code, which i'm using for refreshing the
.
I'd check that the URL is correct:
You can use Firebug (or another Javascript debugger) to watch the request going out, and you can see if it was a 404 error or if it worked.
Also, in the Console, just type in $('#refresh') and make sure it returns an actual object.
if it just displays [] or undefined, then the selector is wrong.
Try:
function updateShouts()
{
$('#refresh').load('ajax/check.php');
};
setInterval(function(){updateShouts();}, 10000 );
Problem is with most localhost dev servers the configuration, security, etc.. is usually at the load end of the scale vs a host else where. So that may or may not be part of the issue, I couldn't say for sure though
Edit I agree with the notion of checking to make sure the path ajax/check.php is valid also. And that Firebug is a very handy tool to have when developing with jquery (or javascript stand alone)

Categories

Resources