Website javascript calculator not working, need solution - javascript

I recently made my website SSL certified, but now my calculator is broken.
Url: https://secondunitcentersmc.org/calculator/
Please help provide a solution, the only affected drop down is the first location one.enter image description here
Console Log Error:
angular.js:12011 Mixed Content: The page at 'https://secondunitcentersmc.org/calculator/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://secondunitcentersmc.org/wp-content/themes/secondunitcenter/calc/data/rents.json'. This request has been blocked; the content must be served over HTTPS.
Changing this URL to https does not work, (it causes the form to not appear) neither does changing $http to $https in both locations within the file
Image from scripts/app.js of my website. It is also a wordpress site.

So When I navigate to http://secondunitcentersmc.org/wp-content/themes/secondunitcenter/calc/data/rents.json it is automatically changing to https. In your js file where you make the call to this page, does the url there start with http or https?
Instead of using a json file for this data, you might want to consider creating a private custom post type for the locations, then you can just use the standard wordpress query to call them into the drop down. It will also be easier to add and edit them in the future. (and get rid of your https/http error :))
How did you add https to your site? with a plugin or manually? If manually- you need to update your site address and wordpress address in general>settings as well as add some code to your .htaccess file. more info here (method #2) https://www.wpbeginner.com/wp-tutorials/how-to-add-ssl-and-https-in-wordpress/

Related

(Web Server) Can't find a folder JavaScript script is successfully reaching

I'm working with an HTML file that sends data using AJAX through POST to https://www.example.com/register_email.
If I copy & paste https://www.example.com/register_email in my browser it returns
{"status":"error","message":"Please enter Email"}
but in FileZilla I'm not able to find anything called "register_email", same goes with my hosting's file manager.
Is the site being requested by AJAX owned by you? If not, since you have no control over the site you won't see anything called "register_email" in your server's directory.
When you past it in the browser you get an error is because
browser requests web pages using GET method
no data is being passed
Lastly if the domain (to which the request is being sent) is yours, and you still don't see anything called "registered_email" try searching using filezilla or see if there is an htaccess rule for masking the url

How to change relative paths to point to server instead of localhost?

I'm working on a Vue app. I have a scenario where I have to call a service with Authorization header information and what I get back is HTML (an entire page with pre-rendered charts) that I have to display in a component.
The problem is, the HTML from the response has a bunch of relative paths for CSS, JS and image files. When I bind the HTML to my component, it is taking the relative path of my localhost instead of the server where this is coming from. Therefore, it cannot locate the necessary files to load.
If I enter the same URL endpoint and pass the Authorization header information from Chrome using the mod-header extension, I am able to see the rendered page.
I have tried using v-html and iframes to render the HTML, but it didn't work. Also tried passing the Host as header information. Any help is appreciated
You can try to intercept HTTP requests using a service worker
https://livebook.manning.com/book/progressive-web-apps/chapter-4/23
Also this is related: how-to-alter-the-headers-of-a-request

Deleting temporary url insecure logo link from Wordpress site

I have a wordpress site that we recently made live. We built it with a temporary URL and then switched it to the live url. I'm getting a soft failure for the SSL because of the theme's default logo.png. I've done better search and replace to try and change it but it can't since it's hardcoded. How and where would I change that so that it shows the live url and is secured?
Website is hobnobevents.com
Error from whynopadlock.com: https://www.whynopadlock.com/results/828a837d-e8d4-4553-8492-5b1d7e784454
An image with an insecure url of "http://185.56.86.90/~onetoncr/hobnobevents.com/wp-content/themes/bodega/img/logo.png" was loaded on line: 1 of https://www.hobnobevents.com/.
Errors that are reported on line 1 are generally not part of the source code. This error may be caused by an external javascript file which is writing to the page, however we are unable to reliably detect these scripts in our automated test.
Please contact us using the "Need Help?" link below if you need assistance with resolving this error.
This File is Present in Your JavaScript.
URL of JavaScript
https://www.hobnobevents.com/wp-content/themes/bodega/js/default.min.js?ver=5.3.2
Code is
$j([theme_root+'img/logo.png']).preload()
Check this code or change the theme_root may help you.

403 Server Error when adding Javascript to page using HTML Widget in Elementor

Using the HTML widget in Elementor Pro, I add a javascript tag to the page, hit update, and get a 403 error.
The javascript is a dynamic, simple sign up form that embeds properly.
I do not have any security plugins like WordFence that would be conflicting, and I have disabled all plugins just in case.
I have seen this: Update button does not work but I don't have access to the site's files, so I can't increase the memory limit.
Server Error
Please follow these steps in order to whitelist the Elementor plugin:
Go to Wordfence -> All Options
Scroll down until you see Whitelisted URLs
Put /wp-admin/admin-ajax.php for the URL
Select Param Type: POST Body for the dropdown
Put actions for the Param Name
Click Add
Click Save Changes in the top right corner
from wordpress support
If You use Wordfence Follow #Luis Alvarado Day answer.
other plugin may have this option differently.
If you did not use any security plugin then maybe your cPanel have Security software like "ModSecurity". Go to the cPanel and disable for your domain.

load external webpage and add custom header and use the data from webpage

I want to load a external webpage on my own server and add my own header. Also i need to use the data from the external website like url and content (i need to search and find specific data, check if i got that data in my system and show my data in the header). The external webpage needs to be working (like the buttons for opening other pages, no new windows).
I know i can play with .NET to create software but i want to create a website that will do the trick. Can this be done? Php + iframe is to simple i think, that won't give me the data from external website and my server won't see changes in the external url (what i need).
If it's supposed to be client-side, then you can acquire the data necessary by using an Ajax request, parsing it in JavaScript and then just inserting it into an element. However you have to take into account that if the host doesn't support cross-origin resource sharing, then you won't be able to do it like this.
Ajax page source request: get full html source code of page through ajax request through javascript
Parsing elements from the source: http://ajaxian.com/archives/html-parser-in-javascript (not sure if useful)
Changing the element body:
// data --> the content you want to display in your element
document.getElementById('yourElement').innerHtml = data;
Other approach (server-side though) is to "act" like a browser by faking your user-agent to some browser's and then using cUrl for example to get the source. But you don't want to fake it, because that's not nice and you would feel bad..
Hope it gets you started!

Categories

Resources