Blazor Javascript Drop-In Script Not Working - javascript

I am working on integrating Chargebee into a Blazor app. The way the drop-in script for Chargebee works is I need to include a javascript script, which I am doing in my index.html file.
<script src="https://js.chargebee.com/v2/chargebee.js" data-cb-site="sitename-test"></script>
Then, in theory I should be able to just include a drop in link in one of my razor views like this.
Subscribe
But when I do this and run the site, click the link, nothing happens, no error, no drop-in popup. Is there something about Blazor that doesn't allow this action to work the way it would work with another framework? I have tested this with plain HTML files and it works fine.
Thanks in advance for any help.

You will need to call Chargebee.init(options); via JSInterop. See the documentation linked below for more details on the Chargebee JS API.
https://www.chargebee.com/checkout-portal-docs/api.html#chargebee-object

Related

Remove html elements from a live website in webview

In webview, can you remove html elements from a live website before it loads to the user?
I've been looking at a bunch of stackoverflow questions regarding this, except I realized they were only locally hosted Web pages inside the app. None of their solutions worked for me.
Any help would be appreciated.
Read first about building apps in webview and how to use javascript in it. Then try to accomplish your goal using Javascript, because it cannot be done simply with webview on android. GL!
One easy way of doing that, will be to first make an http request to load the html data from the website. Then edit the data (remove whatever you don't like from it). Finally display it into the webview with loadData.
However this may not work as you expect, considering the css or javascript from the page you want to load may be in seperate files.

update jQuery to use with widget

I'm trying to upgrade a site template that uses mainly jQuery 1.08 to use 1.11, since a widget I want to connect to the subscribe form uses 1.11.
Here's the template I'm using:
http://multifour.com/projects/ray/ios/image-intro/index.html
What's weird is if I use the following code, the header is there but the form doesn't work properly:
<script src="scripts/jquery-1.11.0.min.js"></script>
And if I use this code, the form works but the header disappears:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
I can't use both either, because whenever I enter the second line the header disappears for some reason. What gives, can someone please help me? Thanks!
For your first problem
I checked your directory for the jQuery script and it returned a 404. Perhaps you updated it because I noticed a different jQuery version being loaded in your view source.
http://multifour.com/projects/ray/ios/image-intro/scripts/jquery-1.11.0.min.js
For your second problem
Ya, I've actually included the jquery file in the scripts directory and either way I thought reading it in through googleapis would include jquery anyway. The console is reading two errors, saying that $().smoothScrool and $.stellar aren't functions in a custom.js file. If you check out the source code of the template I linked to and bring up the custom.js file (line 498), it's the exact same as the one I'm using locally. Thanks for your help so far, guys.
You should use some kind of Javascript Loader because your custom.js is loaded before your jQuery libraries are loaded and thats why you would be getting the error $().smoothScrool and $.stellar aren't functions. Maybe try the HTML5 async Javascript attribute.
http://www.w3schools.com/tags/att_script_async.asp

How to modify bigcommerce frontend with api (add js code in app)

I am writing and app for biggommerce which should a bit of code JS to the header. Does bigcommerce allow to do something like that? (something like ScriptTag in Shopify)
Best Regards
Vahe Abelyan
There is no way to access/edit template files thru the Bigcommerce API. It would just be best to guide the user to pasting the JS into their header (as most apps already do).
Rob is correct, however, depending on how complex you want to get you could technically write an app that would fetch or put a file into the theme's template structure using WebDAV.
Basically
if /template/panels/htmlhead.html exists find it, add your script code before , then post file back to webdav
if /template/panels/htmlhead.html does not exist, allow user to upload the default one from their theme, and then have you app do the same thing.
However I'd recommend sticking with the easy way, just provide instructions for a user to place the code into the file themselves. If you want a great example of this, see YOTPO's installation instructions.

Adding Jquery and Other JS libraries to Firefox Extension

How do I include jquery and other scripts in my firefox extension? I know this topic is a copy of many other questions asked on SO, but none of them were so helpful.
I tried using in one of the JS files where i want to use jquery,
Components.utils.import('chrome://myaddon/content/jquery.min.js');
but it gives me an error saying,
ReferenceError: window is not defined
I also tried adding the script in XUL file, but somehow, I cant get it to work as well.
Is there any other way around it?
Ok man here's the solution to using Custom Events.
Much thanks to #M.J. Saedy for figuring this one out.
Gist - HERE is a template that will listen to custom events dispatched from non-privileged scope.
You can't import a library to use in your addon. What you gotta do is inject that into the web page you want to use it on.
Is this a bootstrap addon? Did you make a chrome.manifest? Before injecting to websites you have to make the injectable stuff contentaccessible in the manifest.
so an example manifest file:
content myaddon ./ contentaccessible
then your code of Cu.import('chrome://myaddon/content/jquery.min.js') will work
if you want to use this library in an iframe for like a panel. put in that iframe <script src="chrome://myaddon/content/jquery.min.js">
Let me know if you need more help, if you upload it to GitHub I can see what exactly you're doing

How to build GWT standalone offline application?

I need to design SPA with GWT technology, but I do not understand clearly how to make (compile) only one page with all JavaScript code in it.
So, for example my task is to make simple page with button and div. You click on button and div appears on page. Simple.
When I did this on GWT, I can not find a way to compile this page in simple index.html with all JS code inside (or in one .js file). Page should work in offline mode.
GWT do it for you. compile it to one .js file?
Here is simple tutorial http://code.google.com/intl/en/webtoolkit/doc/latest/tutorial/gettingstarted.html
If you have any other question, please ask
and have a look at this.allyou need is here
http://www.vogella.de/articles/GWT/article.html
Try Gears with GWT from google here the specs:
http://www.slideshare.net/tom.peck/going-offline-with-gears-and-gwt

Categories

Resources