Prompt to approve use of computer location using Google Maps auto complete - google-maps-api-3

I'm creating a registration form and using google maps API v3 to auto complete the address fields.
I've used this code
I'd like to prevent the "[the site's url] wants to use your computer's location..." browser prompt from appearing since i have no need for it. (the user will input their address which will be auto completed)
Is it possible to use location auto complete without trying to retrieve the computer's location?
If so, should I make changes to the geolocate() function mentioned in the code and if so how?

Delete the geolocate function if you have no need for it, and remove the onFocus="geolocate()" from the input box. Instead you really need to amend the fillInAddress function. Presumably you'd want to add an event listener for when the value in the first text box gets updated. You'd then need to use the Places service to look up addresses based on the users's input as they type (or perhaps you could just do it after they've clicked a submit button).
More like the other example in fact, at:
https://developers.google.com/maps/documentation/javascript/examples/places-searchbox

Related

Google Optimise - How to test a page that only loads the required content when called in a specific way

I have a multiple-step flow that I would like to run A/B testing on, in this case by hiding/removing a single checkbox on one screen to find out if it impacts on the CTR of the Continue button on that screen. I haven't done this before so I might be missing some basic knowledge. The issue I have is that the target page doesn't load the required control by default, i.e. if you just type the URL into the search bar it comes up blank, because it's missing required data that normally comes from the referer page (which identifies the charity they want to donate to). To complicate things further, the control I want to test is on the second screen of the flow, and all screens have the same URL. When I set it up in Google Optimize, it doesn't show any editable content.
To be a bit more specific, the content displayed is dependent on POST parameters passed in before the stage I want to test. Is there any way to either (a) force Google Optimize to load the page using specific POST values, showing the relevant control so I can disable it for the B variant, or (b) bypass using the visual editor and disable the control by ID? Or will we need to rewrite the whole flow to use separate URLs for each stage and to load relevant content even when required data is missing?

Drupal: How to Figure Out the token for a Specific Field?

I would like to know how to 'construct' tokens. I have read many examples, but somehow I don't understand them. I am new to Drupal and at the moment I am testing how it works. I'm trying to hide the title of a content type I've created and automatically replace it with the content of another field. As far as I know, I have installed and enabled all the relevant modules including CCK and Automatic Entity Label. The only thing I don't know is what token I should use to make it happen. The field I would like to use as the source for the title field is called event (or possibly field_event) and is of type text. I'm visually impaired and either I'm doing something wrong, or the token browser is not too screen reader friendly. Either way, I can't access the list of all tokens to select the token, so I have to enter it manually. If I'm not mistaken, the token should include '[node:body]', right? But is it like '[node:event:body]' or '[field:event:body]' or something else?
Many thanks!
One Idea might be the devel module https://drupal.org/project/devel . Install it, activate it and visit some page of the node type you want to use the token on, and click on the devel tab and then on the token tab. et voila. or you navigate directly to e.g. yoursite.com/node/29/devel/token .
Hope it helps.

Django: Hiding necessary forms on template page

I have a Django application which takes the lat/lon from a user's coordinates via HTML5 geolocation and places these into form fields via jQuery. Markers are then placed on a map using these coordinates. This works very well.
The problem: I want to hide these forms so they're invisible to the user, but these still need to be "on the page" so they can receive the information. So excluding these via the Django forms file won't be acceptable.
I tried one method which hid the form field but left the form label. I'd like to hide the entire row from the user and remove the space where the form field exists while it still remains in the background to receive the info.
Is this possible? Not sure if it requires a CSS trick or a something built-in to Django.
Any help or insight appreciated.
Give your forms an ID and in CSS set display: none for these IDs. Alternatively, use a common class instead of separate IDs.

How can I stop the Flash privacy popup from occurring twice on a page?

My web-app records users via webcam and microphone. I want to use HTML/JS for the controls and content, so I created two separate Flex modules:
* A "Webcam Setup" module that lets you choose your camera and mic input devices
* A "record" module that lets the user record and submit the recording
When I embed either of these on the page, since they access the user's Camera/Mic object, Flash shows the Privacy dialog that says "[mysite] is requesting access to your camera and microphone. If you click Allow, you may be recorded."
The problem is, if I answer Yes in the Setup module, and later add the Record module to the page using Javascript, it again shows the Privacy dialog.
Is there a way to avoid the second privacy popup?
I would think that saying "Yes" for [mysite] would store that permission for at least that session, but apparently not.
What I've tried
I tried combining them into one SWF, adding it to the page once and moving the DOM element with jQuery's append() function when needed. When I move it, however, it reloads and asks me again.
Imagine if [mysite] was, say, blogger.com or livejournal.com (or, if it were still around, geocities.com). Would you want a "yes" response on that site to be good for every page under that domain?
Rememeber, just because you promise (cross your heart & hope to die) not to abuse the security hole you request, doesn't mean they can allow you to have that security hole.
Eventually, I found a usable workaround, similar to what I originally tried (above).
I combined the setup and record modules into one SWF. I first show the setup screen. When the user hits the Continue button on my page, Javascript calls a function in the SWF to swap to the Record screen.
I then move the <div> containing the Flash object to another location on page using absolute positioning, and resize the object.
Previously, I was trying to use jQuery's append() function to move the div within the DOM, and that was causing the SWF to reload. Just changing position and size does actually work.
You could build the "record" component to simply send and receive signals using an API you've created for your "setup" component (which has already been authorized, meaning one auth & two swfs) by using the LocalConnection class:
http://livedocs.adobe.com/flex/3/langref/flash/net/LocalConnection.html
This seems far closer to best practice than the other implementations mentioned, which smell a bit hacky and would probably confuse anyone who may inherit the codebase in the future.

How to give a link from php page to another URL with a flex state?

If I want to navigate directly to the second state of some flex app, for which the link has to be given from another php page. How to do it? If I give the normal URL it will anyway land me to the first state.But I want it to directly go to the second.
Pass in the state via flashvars. Then use whatever is passed in to define the state.
The best way to do this would be to use deep-linking. It takes a little more work but has other benefits in your applicaiton anyway.
http://livedocs.adobe.com/flex/3/html/help.html?content=deep_linking_1.html
basically you would just give the url and put extra information on the end, something like:
http://myurl.com/myapplication.html#state=second
The other way to do it would be to pass in the state via flashvars like Zack said, and then just change your state on creationComplete.

Resources