Using javascript within Sparkle

Can anyone tell me if it is possible to use javascript within the ‘embed’ function of Sparkle. I want to use generated script to create a sales widget

Many thanks

@richardsurman, Yes it is! You just have to keep the script within the tags <script></script>
that you place into the “Embed” element on the right-hand side of the Sparkle canvas.

1 Like

Thanks for your response. This doesn’t seem to work for me. I paste in the script as follows and when I preview the page nothing appears. I guess I’m doing something wrong but I don’t know what.

.

Perhaps you’d be kind enough to see what I’m doing - I attach a screenshot

Many thanks Richard

PS I’m viewing in Live Preview - does that support embedded html?

@richardsurman, Is there any other code that needs to be added? or is it just what you have shown me here?

That’s the entire code. I’m migrating from Muse where the code works perfectly (see www.southsidehouse.com/whatson.

Hi @richardsurman, could you provide that code as a code snippet here so that I can copy/paste it and try it?

I looked at that page you mentioned, but it’s not working at all for me (big alert when just loaded), and it doesn’t seem to contain the code in this screenshot.

I did paste a different ticketinghub embed from that page, and it worked fine in the Sparkle preview. It didn’t show up in the canvas, and that can happen for many reasons.

@richardsurman, Like Duncan mentions your Muse site isn’t opening. I remember this issue happening towards the end of using Muse and to fix it you need to totally upload the site overwriting what you have on the server.

Also check if you have an SSL Certificate against your domain name? The script you screenshot is using “https://” and I’m noticing that it is becoming more and more of an issue not having a SSL Certificate, aka weird issues popping up!

1 Like

Hello @richardsurman

I get this message when visiting your website:

31

Many thanks for the heads up on this. I’ve overwritten the whole site so hopefully that problem should clear

Yes - Muse is driving me nuts at the moment - I’ve a high spec iMac and Muse is so slow it’s unbelievable. There is an SSL certificate but in Safari the site url is marked as not secure. The sooner I can get one or two wrinkles sorted out with Sparkle, the better. It’s quick and just pleasant to use. Thanks for you comments

Hello Duncan. Please try it! Could it be that it doesn’t show on a local browser? I don’t want to upload and overwrite the existing Muse site until I’m completely sure I’ve got the sales widget problem cracked. Many thanks

That’s definitely possible. You can publish to a subfolder of your main site.

@richardsurman, Yes Muse is having issues a bit, but it could also be host related? The issue with your SSL Certificate is another matter and for the most part is a needed manual addition to your hosting package that hosts your website.

We need to force all “http” onto “https” and if you follow the linked guide then it will resolve the issue - https://www.siteground.com/kb/how-to-force-ssl-with-htaccess/

1 Like

Thanks for this - will try to sort it

Not sure about your server, on mine, you need to upload this file (with your own domain in it).
I edit the file using BB Edit, save it as “htaccess”, then upload it.
Once on the server, edit the file name to begin with a period. You cannot name a file this way on your Mac; it will object. Here is the code:

SECURE SITES code to force HTTPS and stop warning

USE THIS CODE IN AN .htaccess file and upload to the server in each domain’s public_html directory. Customize for each domain… replace “domain.com” with my domain name.

RewriteEngine On**

RewriteCond %{SERVER_PORT} 80

RewriteRule ^(.*)$ https://my domain.com/$1[R=301,L]

2 Likes

@macmancape, Yep I get you on this! The server I use has the htaccess file by default and then I just add this code to force all “http” to redirect to “https”…

RewriteCond %{HTTP_HOST} yourdomain\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://yourdomain.com/$1 [R,L]
1 Like

There are a couple of issues here that may be causing you problems. Firstly, if you have mixed content issues (such as a non ssl site accessing content on secure sites or the other way round). This is easily fixed by adding the following code to your .htaccess file:

Header set Content-Security-Policy: upgrade-insecure-requests

The page on your site appears to be unable to access certain scripts and css files. The errors are shown below:

[Error] Failed to load resource: the server responded with a status of 404 () (master_whats-on-master.css, line 0)

[Error] Failed to load resource: the server responded with a status of 403 () (checkout.js.map, line 0)

[Error] Failed to load resource: the server responded with a status of 403 () (application-f3f93c790e3166224a2d844d24b24bab0c4c7034.js.map, line 0)

[Error] Failed to load resource: the server responded with a status of 403 () (index-d70f9e789ad0a5b573eba2ae0c1c1da7d5fa05bf.js.map, line 0)

The 404 message simply means the content could not be found. The 403 messages suggest that the server hosting the content refused a request to serve the content. These 403 errors may be related to the mixed content issue stated above.

Also, try to avoid using the www prefix in your domain names and any links that may include your domain name - its not necessary and could cause further complications.

1 Like