How to add Google places autocomplete to flask? - javascript

I would like to add the Google places autocomplete library to an input field but am not able to in my flask app (it doesn't give the dropdown suggestions), although it works fine in a standalone HTML file.

Have you consider using Geocomplete? The example code they provide is pretty easy to implement

If you managed to implement the search box itself in your flask app (it's being rendered and everything) but there are no drop-down suggestions you should be able to find out the exact error message in the developer tools of your browser.
One of the reasons could be that the URL of your web app is not included in your API key to accept requests from.

Related

Wordpress Custom JS Location

We decided to go to another provider and rebuild the website. Accidently, we moved the old domain as well and we can't access the wordpress backend nor the frontend anymor. Now for the new page, I need a Custom javascript code I entered on a specific page with Elementor. Where can I find my old code now without accessing the homepage? I have FTP and Database access.
Where do you put the code? Depending on the answer you need to look at different locations.
Afaik elementor doesn't support custom js nativly. You can bypass that with a html widget or custom plugin. If you used elementors gui for that it's probably stored like all other elementor related content inside wp_post_meta of your database.
If you don't know the page where it was used I would suggest to export the database as sql and use an editor to search for a text string related to the code (for example the url of the ajax request).
If you know the page you can do the same but faster. Look for the id of the post with the code, search for it in wp_post_meta and go on like mentioned before.
If you havn't used elementors gui the script could lie inside a directory on the server probably inside your theme.

Login to a website and scraping its js generated html in android

I am really new to android and I am building an app that will take the username and password of a website(https://lms.mrt.ac.lk).
When the user hits the login button of my android app, the app should itself logged in to the above website and retrieve the complete(including js generated html) html source code.
As a start I tried to print the html source code in the android studio. I tried to use HtmlUnit, but later I found that it is not supported by android. Then, I tried to use Selenium on android, but when tried to build the project it gave me an error "More than one file was found with OS independent path 'META INF' ".
And then tries android's WebView to do the thing, as described in this question, but I don't know how to view the complete html output.
So, my question is -
How to login to a website inside an android app
How to get the complete html source code of the logged in website in android(scraping the js)
I want to do the above in same app. I searched everywhere and still could not find anything complete, that helps a beginner.
Please help me! your suggestions/solutions are highly appreciated.
I'll answer your questions in order.
I don't know what javascript android framework you are using, but the solution should be similar to the java solution. For your specific website, the login endpoint is https://lms.mrt.ac.lk/login.php. You should send a POST request to the endpoint with header parameters LearnOrgUsername and LearnOrgPassword. On success, this should return your desired LoginSessionCookies.
Instead of trying to interpret the javascript stuff, you should rather try to understand how the javascript code retrieves the information you need. And then directly access your information by a web request.

How to develop a Bigcommerce app that would add a javascript tag to all pages in the store?

I would like to develop an app for Bigcommerce that other users of the platform could use. The app should add a simple javascript embed code to all pages of the store. The embed code is similar in nature to google analytics embed or chat services embed codes.
I have opened up a trial account with Bigcommerce and found out that it is very easy to manually edit the page templates to add such an embed code, but I would like to be able to develop an app that store owners could install and not have to mess with editing and copy-pasting embed codes into their page templates.
Unfortunately there is no mechanism currently for BigCommerce that allows for the editing of template code via the app.
I can give you pointers as to where you can put your code to make it globally available.
If you need something in the <head> globally: /Panels/HTMLHead.html
If you need something at the beginning, right after the <body>: /Panel/DrawerMenu.html
If you need something at the end, right before the </body>: /Panels/Footer.html
These are the 3 common places most javascript things (like tracking pixels and analytics) usually go.
Other "extensions" for BigCommerce, such as OLark and Zendesk and Analytics, all just give either a web page with instructions, or a PDF with installation instructions. You could provide your functionality via the same means in lieu of an app doing it.
I haven't really worked with Bigcommerce, but I went thorough their docs and it looks like there is no option for custom module that you can upload and use on their server. And that makes perfect sense.
So I would say the only "forth to try" option is to build browser extension, that does the job for you. As I understood, you can control html output of your store by choosing "Themes" tab > "Edit HTML/CSS", so extension should be able to walk through the three of pages in the left panel.
Chrome Extension
Firefox extension

PhoneGap Android

I am new to phonegap and android , i wanted to know how to access/make database through
javascript. and the second thing i want to ask is how to make Graphs just using html, css and javascript.
Every information is thankfully accepted.
First off, it is best to post each question separately.
To answer both your questions: the easy way is to use Google API's. With the Database API of Google Gears, you can "persistently store an application user's data" locally, and with the Google Chart Tools you can create graphs by simpy calling a URL with the right parameters. Both should work from any browser, including mobile.

iphone, uiwebview with JS (google maps API)

two question for you:
reading google documentation i've make an html with the JS for make a google maps api call.
I've put this file in my project, and in a TABView i read and render this file in a uiwebview.
Works great but every time i start my app and go to this view i got this message: "appleweb://someID want to use your current location".
Is my fault or is normal? why my authrization is not saved in position auth?
Second: if i must make some other request on my map and passing new data or refreshing existent data is better that i do this via javascript or there's some option in cocoa to refresh my view?
It is surely not your FAULT, and yes it is normal. user location authorization SHOULD NOT be saved because the next time user launches his app he wont be knowing that his current location is being used (just in case he wants to avoid that for whatever reason).
I dont know the answer to you second question but just a suggestion: why don't you use MapKit API provided by apple instead of going with html and js for google maps? It is pretty easy to use and theres enough documentation and sample codes available on ADC.

Categories

Resources