"Add to cart" button not working virtuemart 2 - joomla 2.5 - javascript

I have recently moved my site from a local server to a test server on-line. I noticed when I made the change, my "Add to cart" button stopped working. I know if has something to do with conflicting javascript or Ajax. I really need to get this fixed please help.
Here is the link to the TEST site.
http://mackeyshotrods.com/test/store/rvca-detail

Its because of the same origin policy viloation
add the below code to your server side ie. php page
<?php
header('Content-Type: application/x-www-form-urlencoded');
header("Access-Control-Allow-Origin: *");
?>

This problem was occurring for me because the .htaccess was directing to 'http://www.mywebsite.com' (i.e. with www. prefix) and virtuemart/security/'security site url' and 'secure url' were set as 'http://mywebsite.com' (i.e. without www. prefix). Thus causing the same origin policy issue. Changing the virtuemart/security/'security site url' and 'secure url' to 'http://www.mywebsite.com' (so they matched) fixed this problem for me.

Related

How do I ignore "Blocked loading mixed active content" [duplicate]

This morning, upon upgrading my Firefox browser to the latest version (from 22 to 23), some of the key aspects of my back office (website) stopped working.
Looking at the Firebug log, the following errors were being reported:
Blocked loading mixed active content "http://code.jquery.com/ui/1.8.10/themes/smoothness/jquery-ui.css"
Blocked loading mixed active content "http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/jquery-ui.min.js"`
among other errors caused by the latter of the two above not being loaded.
What does the above mean and how do I resolve it?
I found this blog post which cleared up a few things. To quote the most relevant bit:
Mixed Active Content is now blocked by default in Firefox 23!
What is Mixed Content?
When a user visits a page served over HTTP, their connection is open for eavesdropping and man-in-the-middle (MITM) attacks. When a user visits a page served over HTTPS, their connection with the web server is authenticated and encrypted with SSL and hence safeguarded from eavesdroppers and MITM attacks.
However, if an HTTPS page includes HTTP content, the HTTP portion can be read or modified by attackers, even though the main page is served over HTTPS. When an HTTPS page has HTTP content, we call that content “mixed”. The webpage that the user is visiting is only partially encrypted, since some of the content is retrieved unencrypted over HTTP. The Mixed Content Blocker blocks certain HTTP requests on HTTPS pages.
The resolution, in my case, was to simply ensure the jquery includes were as follows (note the removal of the protocol):
<link rel="stylesheet" href="//code.jquery.com/ui/1.8.10/themes/smoothness/jquery-ui.css" type="text/css">
<script type="text/javascript" src="//ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/jquery-ui.min.js"></script>
Note that the temporary 'fix' is to click on the 'shield' icon in the top-left corner of the address bar and select 'Disable Protection on This Page', although this is not recommended for obvious reasons.
UPDATE: This link from the Firefox (Mozilla) support pages is also useful in explaining what constitutes mixed content and, as given in the above paragraph, does actually provide details of how to display the page regardless:
Most websites will continue to work normally without any action on your part.
If you need to allow the mixed content to be displayed, you can do that easily:
Click the shield icon Mixed Content Shield in the address bar and choose Disable Protection on This Page from the dropdown menu.
The icon in the address bar will change to an orange warning triangle Warning Identity Icon to remind you that insecure content is being displayed.
To revert the previous action (re-block mixed content), just reload the page.
It means you're calling http from https. You can use src="//url.to/script.js" in your script tag and it will auto-detect.
Alternately you can use use https in your src even if you will be publishing it to a http page. This will avoid the potential issue mentioned in the comments.
In absence of a white-list feature you have to make the "all" or "nothing" Choice. You can disable mixed content blocking completely.
The Nothing Choice
You will need to permanently disable mixed content blocking for the current active profile.
In the "Awesome Bar," type "about:config". If this is your first time you will get the "This might void your warranty!" message.
Yes you will be careful. Yes you promise!
Find security.mixed_content.block_active_content. Set its value to false.
The All Choice
iDevelApp's answer is awesome.
Put the below <meta> tag into the <head> section of your document to force the browser to replace unsecure connections (http) to secured connections (https). This can solve the mixed content problem if the connection is able to use https.
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
If you want to block then add the below tag into the <head> tag:
<meta http-equiv="Content-Security-Policy" content="block-all-mixed-content">
Its given the error because of security.
for this please use "https" not "http" in the website url.
For example :
"https://code.jquery.com/ui/1.8.10/themes/smoothness/jquery-ui.css"
"https://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/jquery-ui.min.js"
In the relevant page which makes a mixed content https to http call which is not accessible we can add the following entry in the relevant and get rid of the mixed content error.
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
If you are consuming an internal service via AJAX, make sure the url points to https, this cleared up the error for me.
Initial AJAX URL: "http://XXXXXX.com/Core.svc/" + ApiName
Corrected AJAX URL: "https://XXXXXX.com/Core.svc/" + ApiName,
Simply changing HTTP to HTTPS solved this issue for me.
WRONG :
<script src="http://code.jquery.com/jquery-3.5.1.js"></script>
CORRECT :
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
I had this same problem because I bought a CSS template and it grabbed a javascript an external javascript file through http://whatever.js.com/javascript.js. I went to that page in my browser and then changed it to https://whatever... using SSL and it worked, so in my HTML javascript tag I just changed the URL to use https instead of http and it worked.
To force redirect on https protocol, you can also add this directive in .htaccess on root folder
RewriteEngine on
RewriteCond %{REQUEST_SCHEME} =http
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#Blender Comment is the best approach. Never hard code the protocol anywhere in the code as it will be difficult to change if you move from http to https. Since you need to manually edit and update all the files.
This is always better as it automatically detect the protocol.
src="//code.jquery.com
I've managed to fix this using these :
For Firefox user
Open a new TAB enter about:config in the address bar to go to the configuration page.
Search for security.mixed_content.block_active_content
Change TRUE to FALSE.
For Chrome user
Click the Not Secure Warning next to the URL
Click Site Settings on the popup box
Change Insecure Content to Allow
Close and refresh the page
I found if you have issues with including or mixing your page with something like http://www.example.com, you can fix that by putting //www.example.com instead
I have facing same problem when my site goes from http to https. We have added rule for all request to redirect http to https.
You needs to add the redirection rule for inter site request, but you have to remove the redirection rule for external js/css.
I just fixed this problem by adding the following code in header:
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
#if (env('APP_DEBUG'))
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
#endif
Syntax for Laravel Blade, Remember to use it for debugging only to avoid MITM attacks and eavs-dropping
Also using
http -> https
for Ajax or normal JS Scripts or CSS will also solve the issue.
If your app server is weblogic, then make sure WLProxySSL ON entry exists(and also make sure it should not be commented) in the weblogic.conf file in webserver's conf directory. then restart web server, it will work.

Is a 301 redirect the same as changing window.location?

I am a web developer who also works in SEO.
I want to 301 redirect one page to another page.
Is this 301 redirect for Google beyond what I write below for you?
In JavaScript:
<script>
window.location.replace("https://example.com");
</script>
In PHP:
<?php
header("Location: https://example.com");
?>
Are these two 301 redirects, or do we have to write .htaccess in the cat file, for example?
You can not do this with JavaScript.
But you can use PHP as follows
<?php
header("Location: https://example.com", TRUE, 301);
exit;
?>
Syntax header
header(header, replace, http_response_code)
Changing the URL with window.location in JavaScript is not a 301 redirect. JavaScript runs after the page has been generated on the server. Your JavaScript to change the URL would likely run on a page that has a 200 OK status.
That being said, Google treats JavaScript redirects very similarly to 301 permanent redirects. In most cases, Google will choose not to index the redirecting URL and pass the link juice from it to the target of the redirect.
On the other hand, clients that don't execute JavaScript won't see your JS powered redirect. That includes other search engines like Bing, Baidu, and Yandex, as well as broken link checkers and other SEO analysis tools.
Furthermore, even to Google, 301 redirects are a much stronger signal than a JavaScript redirect. Google is most likely to honor a redirect when it is a 301 Permanent variety compared to JS redirects, 302 Temporary redirects, or meta refreshes.
If you have the ability and opportunity to implement server side 301 Permanent redirects, you should do so instead of JS redirects.

Insecure <form> call on Wordpress Site

I am going crazy trying to get my site secure. There is a form that is supposedly not allowing my site SSL
When I look it up on WhyNoPadLock.com I get:
Insecure call Found on line # 247 in file:
rideyellow.com/index.html
I looked through the style sheet and have changed all of the hard coded domain links to https already.
We do have a Call Now button in the header that was custom coded into the site. this works with Javascript. Its a plugin called Anything Pop Up. Could this Javascript be the root of the problem? How can I fix this issue?
I cannot find this "form" anywhere. Any help is much appreciated!
I visited your site. You are loading mixed content, as can be seen through the following Chrome console warning:
Mixed Content: The page at 'https://rideyellow.com/' was loaded over
HTTPS, but requested an insecure video
'http://rideyellow.com/wp-content/uploads/2017/01/RideYellow_1.mp4'.
This content should also be served over HTTPS.
Also, you do have a form element in line 247, but you seem to be calling its action over HTTPS, so it should be fine. If you still get issues over this, leave out the action attribute altogether, as you're just referencing the same page.

Form/JavaScript not working on IE 11 with error DOM7011

The register button for our ASP.net form, which uses the __postback function stopped working on IE 11, from the developer console, it shows:
DOM7011: The code on this page disabled back and forward caching. For more information, see: http://go.microsoft.com/fwlink/?LinkID=291337.
Does anyone know how to get around with this? What is this caching thing and why does it mess up forms. I seen similar complaints about this from others.
This issue occurs if the server sends a "Cache-control:no-store" header or sends a "Cache-control:no-cache" header.
I have seen exactly the same error, also with IE11. In my case the issue occurred when user clicked <button> element, which was inside <form> tags.
The issue was remedied, by placing the <button> outside of <form> tags.
This error occurred for me when using window.location.reload(). Replacing with window.location = window.location.href solved the problem.
I faced the same issue before.
I cleared all the IE caches/browsing history/cookies & re-launch IE. It works after caches removed.
You may have a try. :)
In my case, this exception was being caused by an unsecure ajax call on an SSL enabled site. Specifically: my url was 'http://...' instead of 'https://...'. I just replaced it with '//...'.
To me, the error was misleading, and hopefully this may help anyone landing here after searching for the same error.
I run into this when click on a html , it is fixed by adding type = "button" attribute.
I got the same console warning, when an ajax request was firing, so my form was also not working properly.
I disabled caching on the server's ajax call with the following response headers:
Cache-Control: no-cache, no-store, must-revalidate
Expires: -1
Pragma: no-cache
After this, the form was working. Refer to the server language (c#, php, java etc) you are using on how to add these response headers.
I had a similar problem on Internet Explorer, and got the same error number. The culprit was an HTML comment. I know it sounds unbelievable, so here is the story.
I saw a series of 6 articles on the Internet. I liked them, so I decided to download the 6 Web-Pages and store them on my Hard Drive. At the top of each page, was a couple of HTML <a> Tags, that would allow you to go to the next article or the previous article. So I changed the href attribute to point to the next folder on my Hard Drive, instead of the next URL on the Internet.
After all of the links had been re-directed, the Browser refused to display any of the Web-Pages when I clicked on the Links. The message in the Console was the Error Number that was mentioned at the top of this page.
However, the real problem was a Comment. Whenever you download a Web-Page using Google Chrome, the Chrome Browser inserts a Comment at the very top of the page that includes the URL of the location that you got the Web-Page from. After I removed the Comment at the top of each one of the 6 Pages, all of the Links worked fine ( although I continued to get the same Error Message in the Console. )
Go to
Tools > Compatibility View settings > Uncheck the option "Display intranet sites in Compatibility View".
Click on Close. It may re-launch the page and then your problem would be resolved.

How to break out of an iFrame when a pop up is in front?

My site has been copied via an iframe and I can't break out, I think because there is a popup infront of the iframe.
This site http:// facebvook . info/claim.html (I broke the link so they don't get a backlink) is the offending site, my site is visible behind the popup.
I've tried the following javascript in my header:
if (top != self) {
top.location.replace(document.location)
alert('busting you out, please wait...')
}
But it doesn't work.
What I ideally want is for my site not to load in the iframe at all, but any other soloution would be good too.
You can send the X-Frame-Options header with a value of 'SAMEORIGIN' to prevent other sites from embedding your site.
In PHP you can do that like this:-
<?php header( 'X-Frame-Options: SAMEORIGIN' ); ?>
Or if you have mod_headers enabled you can create an .htaccess file in your document root with the following text:-
Header always append X-Frame-Options SAMEORIGIN

Categories