How do we identify the user's web browser in flex ? Based on the browser I have to display some text in my flex application.
Any help would be appreciated.
Thanks
Short answer is to use ExternalInterface to call JavaScript code.
I would take a look at these pages from the documentation for more in depth information:
http://livedocs.adobe.com/flex/3/html/help.html?content=18_Client_System_Environment_7.html
http://livedocs.adobe.com/flex/3/html/19_External_Interface_04.html
http://livedocs.adobe.com/flex/3/langref/flash/external/ExternalInterface.html
Yes, Javascript code gives you access to Navigator object, which inturn can give you the browser details.
Here's an example I obtained on Googling
http://www.tharas.in/2009/12/getting-client-browser-environment-in-flex/
From ActionScript,
var result:String = ExternalInterface.call("eval", "navigator.userAgent");
which gets the value for the browser name, stores it in result.
Related
My Google Apps Script web app stopped working.
Whenever I click on any element that has onclick property I am getting the following error message:
[11:27:44.243] cannot use the given object as a weak map key
Is there any workaround?
How can I get user's response without onclick event?
My code:
Note that I am trying to add onclick event using both ways, programmatically in JavaScript and by using HTML.
var by = document.getElementById("yes");
by.addEventListener('click', submitResponse,false);
This problem was submitted as google apps script issues:
http://code.google.com/p/google-apps-script-issues/issues/detail?id=2625
thanks for help!
Since this is an acknowledged issue with Apps Script, there isn't much that can be provided here in Stack Overflow.
Here is a bit more context, this was broken and now fixed in Caja. This fix should be reflected in Apps Script in a few days.
I'm using a fresh iPad split-view template application in Xcode. I've added a sample data array and the data shows up just fine in the Popover view. However, when it's tapped, it doesn't call any methods from DetailViewController.m (setDetailItem in particular) like I'd expect it to.
Am I missing something here?
(I'm not sure what code I should post for this particular question, so I'll wait on you guys to ask for it.)
Thanks SO much in advance!
To troubleshoot this issue, you should check the method called didSelectRowAtIndexPath in the delegate for the table view. I remember that was called RootViewController by default and exists in the RootViewController.m file.
It should call the setDetailItem method. Check if it does so.
Posting the didSelectRowAtIndexPath method body here will help better.
I have written a ASP.NET program for a customer, I want to add a message similar to "Preview version, ABD Consulting" on the master.master page, I had thought to use Response.write but it messes up the look of the page as it seems to move page elemets. If I use a label the customer can remove it from the Master.master file, any suggestions? The customer is in a different country so I want to ensure I'm paid.
Many thanks
Serve it on your own server. If it's a preview, they shouldn't have access to the code anyway.
There is nothing you can do unless you host it or control the web server it runs on. Nothing you do in code will matter if they are smart enough. They can write their on HTTP Handlers and replace anything they want.
If you programmatically write out the label during the OnPrerender or Render of the page then the client will not be able to remove it. If you then randomize the ID given to the element, they will find it incredibly hard to apply any javascript functions or CSS styles to it, especially if you directly add the styles to it.
Something like this (pseudo code):
HtmlGenericControl label = new HtmlGenericControl("div");
label.ID = Guid.NewGuid().ToString();
label.InnerText = "My copyright or ownership text";
label.Style.Add(HtmlTextWriterStyle.Height, "50px");
label.Style.Add(HtmlTextWriterStyle.Width, "100px");
if you then absolutely position it, it should always show up. Note that it isn't totally untouchable and fool proof, but you want to just make it hard enough that the client doesn't try to remove it.
Obfuscate it in a dll and use the Current Context to write a pretty div like the one that StackOverflow.com uses on top.
I'm with George and Rick - don't let them have the source and serve it up from a server you control. In addition, I'd created a background image that says "Demo". This will remind that they need to pay up.
Looks like access to DOM and rendering details of HTML tags are not availabel in qt 4.5.x .
Current snapshot QWebElement looks like proper class to be used there
Anybody can give me info if is it possible to get from QWebElement information where on page it was rendered ?
Or there are other ways to get that information ?
TIA, regards
In Qt 4.5, you need to write that as a JavaScript expression and evaluate that with QWebFrame::evaluateJaveScript().
Just for reference's sake: for 4.6 and up, QWebElement.geometry() is the best way to do this. Otherwise, user134841's answer about calling into JavaScript is really the only alternative.
It is possible to add multiple reCAPTCHAS in one form? I tried doing so, even giving the multiple reCAPTCHAS different IDs, but when I load the page in the browser, only one of them is shown.
Is this by design? I need the two reCAPTCHAS because one is for Login, and the other one is for the Register form, which will be shown on the same page.
Thanks!
WT
Only one Cpatcha is supported in a page at any time. What you can do is use AJAX and lod captcha after the form is loaded.
This might of some help.
After a quick google search, it appears that it's not currently possible. One suggestion I saw was to pop up a modal recaptcha just as the user submits the form. ondemandcaptcha for Ruby.
I was initially lead by this thread to believe there is no simple answer, but after digging through the Recaptcha ajax library I can tell you this isn't true! TLDR, working jsfiddle: http://jsfiddle.net/Vanit/Qu6kn/
It's possible to overwrite the Recaptcha callbacks to do whatever you want with the challenge. You don't even need a proxy div because with the overwrites the DOM code won't execute. Call Recaptcha.reload() whenever you want to trigger the callbacks again.
function doSomething(challenge){
$(':input[name=recaptcha_challenge_field]').val(challenge);
$('img.recaptcha').attr('src', '//www.google.com/recaptcha/api/image?c='+challenge);
}
//Called on Recaptcha.reload()
Recaptcha.finish_reload = function(challenge,b,c){
doSomething(challenge);
}
//Called on page load
Recaptcha.challenge_callback = function(){
doSomething(RecaptchaState.challenge)
}
Recaptcha.create("YOUR_PUBLIC_KEY");
It is now possible to do this easily with explicit recaptcha creation. See my answer here:
How do I show multiple recaptchas on a single page?
It's not too difficult to load each Recaptcha only when needed using the Recaptcha AJAX API, see my post here:
How do I show multiple recaptchas on a single page?
the captcha has an img element #recaptcha_challenge_image element , so after you set the recaptcha in one div say "regCaptch",get that img src attr
,set your other captcha div html to the old one html and then set the #recaptcha_challenge_image src to the src you get , here is a working example
var reCaptcha_src = $('#recaptcha_challenge_image').attr('src');
$('#texo').html($('#regCaptch').html());
$('#recaptcha_challenge_image').attr('src',reCaptcha_src);