Title: Firebase &amp; load javascript to a single page
Last modified: December 7, 2019

---

# Firebase & load javascript to a single page

 *  [powerfora](https://wordpress.org/support/users/powerfora/)
 * (@powerfora)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/firebase-load-javascript-to-a-single-page/)
 * Hi, I am trying to connect firebase (mobile app development platform) with my
   website. Basically, I hope to sync user-completed forms submitted through the
   website with my app post. Question: What is the recommended way to load javascript
   to a single page, without leaking the information in the file? Thanks for your
   time and help. _ Brian
    -  This topic was modified 6 years, 5 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
      Reason: Moved to Fixing WordPress, this is not a Developing with WordPress
      topic

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/firebase-load-javascript-to-a-single-page/#post-12215561)
 * JavaScript runs client side. Anything in the script is accessible to the user.
   It’s even pointless to encrypt it because the decryption method would need to
   be included. Anything involving sensitive information has to be done server side.
   It’s often done with Ajax techniques.
 *  Thread Starter [powerfora](https://wordpress.org/support/users/powerfora/)
 * (@powerfora)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/firebase-load-javascript-to-a-single-page/#post-12216011)
 * Thanks for your response, bcworkz. In terms of the Firebase-wordpress connection,
   Is there any additional steps I need to do to initialize Google Firebase code
   snippet execution? and what additional lines do I need to add to read/write to
   Firebase realtime database?
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/firebase-load-javascript-to-a-single-page/#post-12217317)
 * If you really need to relay through the server. I’d look at using the REST API
   of Firebase from WP PHP code triggered by either an Ajax or WP API request. I’m
   not sure that’s really necessary. It seems Firebase is intended for direct access
   from your app, despite the insecurity of JavaScript. For one thing, wouldn’t 
   your app be written in Java or Objective-C? That’s different than JavaScript.
   I’d think one would need a rooted phone to dig deep enough to extract sensitive
   data. I’m no security expert, but I think it’d be relatively safe. Of course,
   anything on an attacker’s own device can eventually be extracted.
 * What’s the nature of this sensitive data that you’re concerned about?
 *  Thread Starter [powerfora](https://wordpress.org/support/users/powerfora/)
 * (@powerfora)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/firebase-load-javascript-to-a-single-page/#post-12247866)
 * Let me elaborate on the situation: we are using Firebase as backend for an iOS
   app. At the same time, we have developed a form in our WP webpage, where people
   can login and put in info. We’d like to upload those information to our Firebase
   database, and according to Firebase, it seems that executing some JavaScript 
   codes are the recommended way for web.
 * I’ve tried to embed some JS code for initialization, but they don’t seem to run.
   Can you give more info on how to properly load and execute JS code on a single
   webpage in WP?
 * Thanks!
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/firebase-load-javascript-to-a-single-page/#post-12251300)
 * If the information you wish to protect is sourced from the end user and they 
   are connected over HTTPS there should not be a security concern with JavaScript.
   It’s running in the user’s own browser.
 * How to invoke JS in WP depends on whether the script should be inline or in an
   external file and if it is dependent upon other JS, such as jQuery. For external
   files, the referencing script tag in the page’s head or footer section gets there
   by calling wp_enqueue_script() from within a callback function hooked to certain
   actions, depending upon the nature of the page. For front end scripts use the“
   wp_enqueue_scripts” action. See
    [https://developer.wordpress.org/reference/functions/wp_enqueue_script/](https://developer.wordpress.org/reference/functions/wp_enqueue_script/)

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Firebase & load javascript to a single page’ is closed to new replies.

## Tags

 * [Firebase](https://wordpress.org/support/topic-tag/firebase/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [6 years, 5 months ago](https://wordpress.org/support/topic/firebase-load-javascript-to-a-single-page/#post-12251300)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
