how to debug my website? [closed] - javascript

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I recently changed some stuff on my website and i have just realised that an ajax script stopped working. I paid someone to code it so i really don't know how to debug it.
First here's how it's supposed to look.
If you click on a color, an AJAX script will call a PHP script to check the stock status for the selected color. If the answer is positive then the script will change the tshirt image to display the appropriate color.
The script works perfectly, but as soon as I use the same script on a subdomain it doesn't work. Here's an example of the same script on a subdomain.
The image won't change when a color is clicked.
I tried looking into Firefox Console but i can't find anything relevant.How can i find what's wrong ? Why the image doesn't change on the second link i provided ?

Second link has an error of "Origin http://hooded-sweatshirts.ni-dieu-ni-maitre.com is not allowed by Access-Control-Allow-Origin."
Refer: Origin is not allowed by Access-Control-Allow-Origin

Ajax call not work cross domain..
Below thread may help you..
Cross-domain $.ajax request is not working

I have found three problem on initial checkout of both your sites.
1 ) If you notice from the subdomain the request is going to the live site i.e https://www.ni-dieu-ni-maitre.com/tshirt_ajax.php?checkshop=429942&checkproducttype=111&stockcolor=5&currentsize=3
This should fetch the data from the subdomain site itself, so this url might be hardcoded somewhere in the script.
2 ) Script is trying to load the image from https to http and thus continuously giving error
3 ) Most of the js are loading from the live site onto sub-domain one and also might be a cause for the error occurring to your site.
try differentiating your test domain from live site i.e try not to call live resources from your test domain.. whether they are js or AJAX requests.
Regards

Related

Amazon add to cart via Request [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed yesterday.
Improve this question
we are currently trying to read out maximum order quantity, since there is no option in any Amazon API, so we decided to scrape it in some way.
Keepa has some kind of option which is similar to that we want to achieve, but there is no scalable API available. (Keepa devs told us, there wont be any feature in the near future).
Here is an example:
Amazon has unlimited stock, means you can add 999 to cart and most likely even more
There is no add-to-cart "href" but the whole "buybox" is inside of a tag with an form:
Here is the whole form-tag of the BuyBox
Is there someway without rendering JavaScript to perform such kind of Request to Amazon to simulate a click on the add to cart button?
Thank you guys in advance!
In queries like these, be specific with
URL- you are trying to scrape.
mention the element you are trying to extract.
Share a piece of code, you are facing trouble with.
However, if you are trying to simulate the clicking a button on this website or any other browser like behaviour while scraping. Then, going with the browser-automation libraries with headless capabilities like Puppeteer, Playwright and Selenium are the best options. These libraries automatically renders the script tags. And, you can easily simulate the user-like behaviour like clicking a button in Puppeteer, Clicking the button in Playwright, and Clicking the button in Selenium.

Bug reporting regarding HTML and JavaScript [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 5 years ago.
Improve this question
I believe I have found a bug in HTML / JavaScript, but I have no idea where to post this bug. Any information on where to post such bugs is appreciated.
The bug can be recreated as follows:
Go to W3Schools Tryit Editor
Make sure you have some other tab open in the same window
Click on the input field to focus it
Click on a different tab in your browser
Depending on your browser, different effects will occur (all unwanted)
This has been tested in Chrome (it will give an infinitely repeating alert), on Firefox (it will give the alert, but not switch tabs when clicking the alert away), and on Edge (it will show that the new tab is selected in the tabs bar, but the rest of the page doesn't switchenter link description here).
Since this bug occurs in multiple browsers, and also since the bug occurs with sample code from w3schools, I believe that this bug is related to HTML / JavaScript more than to a specific browser.
W3Schools isn't affiliated with W3C, the organisation who maintain the HTML specification. Nor are they affiliated with Ecma International, the organisation who maintain the JavaScript specification. Nor, for that matter, are they affiliated with any browser.
The code they've supplied here is their own code. It's not official by any stretch of the imagination: it's code that you or I could have written.
However that said, it looks like you have discovered a bug which affects multiple browsers. This is something you an report on the various browser channels if you so desire. Potorr has already linked you to a couple of these, which can be found by simply searching for something like "{browser name} bug tracker" with a search engine.
However you may consider instead posting directly on W3Schools' forum, as, after all, this is their code: http://w3schools.invisionzone.com/index.php?/forum/45-general.

Javascript Alert won't show up [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I'm trying to "hack" a web app by customizing the login page.
I've succefully been able to change an <img>, but I can't seem to use some js.
Whenever I try a simple alert, it shows up on the source code but won't show up on the page.
I wonder if there's any way they blocked js or if I'm missing something on why my alert won't show up.
Below : screenshot of the img tag i've successfully changed and the js I failed to execute from the firefox dev tools.
Please let me know if you're missing some informations.
EDIT : I think I've gave you all the wrong idea :)
I'm not hacking anything. I have the source code of a huge web app.
Now what I'm trying to do is to customize some part of a page. I edited the source code adding an alert (that should show up and that won't).
Here is a part of my code :
<img id="Img_site" src="/images/custom/Img_site.png" style="margin-left:-40px;"/>
<script type="text/javascript">alert("test js")</script>
If you're trying to "hack" a web app that allows users to enter custom code. There is a good change that the developer of that web app put measures in place so strip any scripting. For example i have an application where users can enter custom markup but i have the below code on the front end to strip any script tags and any code in between them before they get submitted to the server. Then on the server I do the same thing to make sure that no script can be passed to the interface effecting users.
var SCRIPT_REGEX = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;
while (SCRIPT_REGEX.test(html_code)) {
html_code = html_code.replace(SCRIPT_REGEX, "");
}
You have to notice that the content is already loaded when you append the script. So it won't excute. If you want inyect javascript code to the web you must use the developer tool.

How to find JS code responsible for scrolling after AJAX call [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
In my website I am using many jQuery plugins and I can't sort out the reason why my page is scrolling up to the top after AJAX call.
Sorry, can't paste code cause even I am not sure which plugin is causing the issue and is there any easy way to find why my page is scrolling up after AJAX call.
Test project hosted at https://dev.ther8server.com (Sorry for self-signed SSL)
Search for Brisbane (Have to wait till autocomplete comes and choose Brisbane, Queensland, Australia)
Can leave the dates blank
And in the hotels list, at the ending there is a button "Show More Deals" when I click that its loading 200 more hotels list but unfortunately its scrolling up and people need to scroll down all the way from up.
Is there any easy way to find which element or which plugin is responsible for this scrolling?
I tried in Chrome Inspector and Firebug and couldn't find the correct code.
Thanks.
In your jquery.main.js I can see this function.
complete: function(data, textStatus, errorThrown) {
//remove the loader and move up
$('#ajaxload_loader').hide();
$('html, body').animate({scrollTop: 0}, 'fast');
}
This line $('html, body').animate({scrollTop: 0}, 'fast'); is the culprit.
Are you, after ajax call, removing/replacing html content controls (such as div or table or tr or p) and then adding new html content? if that is the case I would says it is the reason. because it might be reducing the height of your complete web page/document.
Just superficially checked your code, and found that after ajax call you're setting response in as follows:
$('#ajaxload_pane').html(data);
Instead you should append the data with only the new data something like as follows:
$('#ajaxload_pane').append(data);
Currently it seem you're fetching the whole list again, the ajax call should return only the new entries of hotels.

Single Page HTML Site - SEO technique [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
I developed a Single Page Responsive Website for my company http://germin8.com/ . Everything is going good however I actually now face a problem with SEO .The site's different sections do not show up in search engine.
I know the cause it being a single page site so not crawler friendly...Inorder to get the URL change I used history pushstate technique and have put href links for menu bar items to sections ..... confused ?? eh
Sample anchor tag outlink ( I thought this is enough for my section to show up in Search Engine :-/ )
a style="text-decoration:none;color:black;padding-left:30px;" class="scrollTo" id="contactUs_Menu"
href="/contact-us">CONTACT</a></li>
Or you may have a look at the source code of the website and follow the anchor tags.
On some research and POC I came across this AJAX crawlable technique by google (https://developers.google.com/webmasters/ajax-crawling ) ...however I couldn't understand it and also feel loading site's sections through ajax would be a lot more work at this stage since my entire site is a static HTML file ( index.php ) with nothing rendered dynamically through javascript/AJAX
Someone who has faced similar problem can you suggest me the simplest and fastest way for my site's different sections ( eg .Clients , Partners , Contact Us etc ) to show up in google engine
Thanks in advance guys :)
Actually this question is more suitable for https://webmasters.stackexchange.com/ but since it has been raised here, I'll try and answer this question to the best of my knowledge.
Unfortunately, there is no shortcut for SEO and to be able to fetch search results in your favor is a slow and painful process. The basic principle of SEO is doing simple things right and provide quality content to your users in your website and not worry much about the ranking.
That being said, your expectation is slightly unrealistic for the following reasons,
You are asking Google to index a page that doesn't even exist.
The URL is changed with JavaScript on runtime, which is something no-search-enginebot is good at indexing.
However, there are couple of things that you can improve in terms of SEO (not going to guarantee what you have asked),
Make sure you have sitemap.xml file in the root directory of your website. You need to add individual sub-page links for each url like this,
<url>
<loc>http://germin8.com/clients</loc>
<lastmod>2005-01-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
Once you are done with sitemap.xml file. Open your Google Webmaster Account (also make sure your Google Analytics account is linked to your webmaster profile) and validate the structure and schema of the sitemap file.
Write better anchor text - Add title attribute to your anchor tags. Avoid inline styles as much as you can. Use complete url instead of relative paths for href attribute.
Google doesn't like slow websites. Hence, you need to focus a lot on the performance of your website. Also no user likes to see a webpage loading for ages. Make efforts to concatenate, minify and lint your assets(html/css/js). Gzip compression is required as well.
149 requests with 4.1 MB is huge. You need to reduce the number of HTTP requests you make massively!
Conclusion
Apart from the above, I don't really see your internal links not being visible on search results as a big problem. Your primary objective is to make sure that your users land on your webpage (this is something that you already doing). After the user enters your territory (website) he has the liberty to navigate to any section of the webpage.
http://webcache.googleusercontent.com/search?q=cache:http://germin8.com&client=firefox-a&rls=org.mozilla:en-US:official&strip=1
I dont see any problem with indexing of your site. Clients will not showup in normal search but they would show up in google images. You should give alt tag to best describe the client images that you have used. Above url will give you an idea how Google bot sees your site. So you can notice all text is indexed by google including your heading where clients are listed. Hope this solves your concern.

Categories