How can I set a custom RPC URL into web3 object programmatically instead of doing it on the MetaMask?
My intention is to prevent any mistake from users.
Currently, Metamask doesn't support this feature yet. but as far as I know, they are working on it. You can keep an eye on this issue, and also eip2015.
Related
In my React SPA, I use npm module react-gtm-module to connect it to GTM. I can send events, using this syntax:
window.dataLayer.push({
event: 'calc_price_btn'
})
but I am not sure if and how I can send consent updates. Is it possible with this module, or will I have to use the standard gtag HTML snippet? Can react-gtm-module do everything that standard gtag() calls can?
What I was missing was defining the gtag() function:
window.gtag = function(){
window.dataLayer.push(arguments)
}
It confused me that the Google documentation did not include the dataLayer.push() calls—only the gtag() calls. After defining the function, the code snippets from the docs can be used right away.
You don't really have to do anything special programming-wise.
It'll be more of a configuration in GTM.
There are many community templates that manages this, but I would go with Simo Ahava's https://www.simoahava.com/custom-templates/consent-mode/
Just search for it when adding a new tag in GTM.
Then you'll be able to push to the datalayer with certain events with the update, shown in the image below.
I'm developing a react application that will be slighty different in different situations.
The app will be used on third party web services as plugin loaded in an iframe. In this case I must know who request the app because:
I must rebrand (load a different css)
Disable or enable different services.
Moreover the app will be used as our service and in this case must load the default configuration with our brand and all the services.
I'm wondering how to do that. The simplest things that came in my mind is use the localStorage and save a setting variable just before load the iFrame and in the react app I can use the localStorage to understand what to do. Is this a reliable solution?
Also, the iFrame load the website using a request, maybe I can pass a query parameter and set the style and some other values based on that.
Not sure which is the best way to do that.
You can also set cookies based on who is going to use it, see https://www.npmjs.com/package/universal-cookie, but make sure to have the secure flag switched on.
An example, this is client side
import Cookies from 'universal-cookie';
const cookies = new Cookies();
cookies.set('requestedParty', 'Google', { path: '/' });
console.log(cookies.get('requestedParty'));
I’m currently developing a web app using ReactJS and Firebase, it is going to be some kind of a forum.
Despite minor bugs, the ReactJS-part is done and works.
Currently, to provide a better user experience, I am working on hybrid apps with React-Native and implement OneSignal as a way to send push notifications everytime a user opens up a new thread or his/her own thread is commented.
My question;
is there a way to save time and 'recycle' my ReactJS-WebApp when loading it inside a React-Native WebView BUT providing the WebView with the user authentication data from the React-Native-login?
What I want to accomplish is being able to recieve push notifications (which needs the user to be logged into the app) without having him to login a second time inside the WebView.
[I read about those mixed hybrid apps when getting familiar with PhoneGap and how the folks at Basecamp thought about it, but I have no idea how to accomplish it. I think about the need of building a middleware/adapter/magic-thing to load different scenarios of my ReactJS-app depending on the request coming from an ordinary browser or an React-Native-app.] Thank you so much in advance!
I have a windows 8 hybrid app and now I want to migrate it to UWP. I am facing two issues and I have been searching on the internet for quite a few time. I want to know if UWP support ajax function. Also my anchor tag in href is not parsing. What might be the reason.
I want to know if UWP support ajax function
The answer is yes, you can use ajax in UWP Application. But there are a few things you need to notice when using ajax in UWP.
If you are using ajax to get data from a remote server, please make sure the Internet(Client) capability is enabled in package.appmanifest. If you also want to call ajax from local server, make sure the Private Networks(Client & Server) capability is enabled.
If you are using a Content Security Policy in your app. Make sure the server address of your ajax call is included after default-src or connect-src in <meta>. For details about CSP you can refer to this document.
Cross-Origin should also under your concern when migrating. For enable CORS you can refer to add CORS support to server.
my anchor tag in href is not parsing. What might be the reason.
For safty reason, UWP doesn't support inline javascript. So codes like <a ng-click="jsfunc();"></a> won't work. Please add eventListener in JS files.
The simple thing of calling FB.init (right before </body>) and then FB.getLoginStatus(callback) doesn't fire the callback function.
After some debugging, I think the SDK is stuck in the "loading" (i.e. FB.Auth._loadState == 'loading') phase and never gets to "loaded", so all callbacks are queued until the SDK has loaded.
If I force-fire the "loaded" event during debugging - with FB.Event.fire('FB.loginStatus', 'loaded') in case you're intersted - then the callbacks are invoked correctly.
Extra details that might be relevant:
My app is a facebook iframe app (loaded via apps.facebook.com/myapp)
I'm using IE9. The same behavior happens in Chrome
The app is hosted in http://localhost
What's going on? Why is the SDK never gets to loaded?
Thanks
UPDATE: Just tried it on Chrome and it worked (not sure why it didn't work before). Still doesn't work in IE
I had this same problem in Firefox 3.5 on Windows, but only on the very first log in to the page (probably because it was a slower machine and there was some weird timing issues going on).
I fixed it by forcing FB to refresh the login status cookie every time it checks:
FB.getLoginStatus(callback, true); //second argument forces a refresh from Facebook's server.
Without "force=true", sometimes it wouldn't fire the callback.
I had the exact same problem, and I solved it disabling "Secure Browsing" in the Facebook Security settings. Keeping Secure Browsing on forces the pages as "https", but I had no "Secure Canvas URL" set up, and this gave me a lot of errors in the console as well.
Hope this may help someone :)
In my experience, getLoginStatus() never calls the callback in Firefox when third-party cookies are disabled.
The original poster mentioned his application is hosted on http://localhost. I've never had luck with that, and believe it will cause problems.
Just today, I've had problems where getLoginStatus is not calling the callback on any browser, unless the user is actually connected to the app! I'm hoping this is a bug on facebook's end that they will solve.
Yet another possibility for FB.getLoginStatus not firing its callback is when using a "test" user account that has not been authorized to view that application. Its pretty bad that facebook doesn't give you any error messages.
I have also seen failed callbacks on bad appIds and redirectUrls.
I also ran into this issue specifically in Chrome. I tried calling it on page load and after a user-initiated action with no success.
It turned out that it was not a cross-domain issue. The getLoginStatus() call was being blocked by the Un-Passwordise extension in Chrome. As soon as I disabled the extension, it worked perfectly, even on page load.
More info about this issue here: Chrome-only cross-domain scripting errs in Facebook iFrame App upon FB.Login(..)
I understand that this question is a little old now, but I ran across it searching for solutions.
Double-check what you have set in your Facebook app configuration under the section "Website with Facebook Login". The Site URL domain must match the domain your page with the FB.getLoginStatus (and other related auth Javascript) is served from.
After hours of struggling, I realized that I could not reuse an existing app configuration I had on a new server and had to create a new app to handle the website login for this new server.
The other answers are probably equally valid in your specific case, but since there may be others like me who have struggled for a while on this, hopefully this gives you one other place to check. Making a new app with the correct Site URL was the answer in my particular case.