Remove UIWebView selection highlight? - ios

So in a UIWebView, whenever you press anything, a grey selection box appears. Like this:
I know you can remove it if you have access to the source code of the website, but obviously in this example I'm using YouTube, which I cannot access. Can I remove the grey highlight within Xcode?
Many thanks!

Why not use JavaScript-injection?
[webView stringByEvaluatingJavaScriptFromString:
#"document.body.style.setProperty(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");"
];

Related

How to auto tap a button inside webview and how to autofill a form inside webview

Need help on ios webview
I am trying to autofill a form located on any website can get path by ID or Xpath.
same with button want to know how to autotap send button after filling a form located on any website can get buttons xpath/ID
In selenium it was simple and easy dont know how to dive into webview looked everywhere
You use the javascript bridge to perform operations on elements using js. For example to tap on a button:
let jsString = "document.getElementById('myButtonID').click()"
myWebView.evaluateJavaScript(jsString, completionHandler: { result,error in
print(result);
})

firefox addon sdk override link preview text

I'm new to developing firefox addons and was wondering if there is a way to override/modify the link preview text that appears at the bottom of the browser when you hover over a link.
I've looked briefly and wasn't able to find any reference describing this.
Thanks for any thoughts.
You can set the status text like this:
aDOMWindow.XULBrowserWindow.setOverLink('blah')
Where aDOMWindow is a window like that returned from for example Services.wm.getMostRecentWindow('navigator:browser').
So like do link.addEventListener('onmouseenter'.... a function that does setOverLink
and to make it go away set it to blank string. So just window.XULBrowserWindow.setOverLink('')
But you are doing this on mouse enter of a link and by default mouse out of links will blank it so you may not neede to handle blanking it.
edit:
you asked about add-sdk, so the Services.wm.getMostRecentWindow might not make sense, so here's a quick test you can try in sdk:
const { getMostRecentBrowserWindow } = require('sdk/window/utils');
getMostRecentBrowserWindow().XULBrowserWindow.setOverLink('hiiiiiii!!!')

How to addd an 'close' button to a pdf loaded from within an app by uiwebview

We can use UIWEBVIEW to create a loading mechanism for viewing a pdf file when called in our app and we have successfully put in a 'close' or 'done' button that allows us to exit the pdf and return to the app. Our app is a website compiled using Xcode 5.1.
PROBLEM: Our 'close' / 'done' button appears on every page of our website app rather than only when the pdf is loaded. What we want is for the button to only appear when the pdf is loaded and when pressed, we can return to the app and the button disappears.
Any help very very much appreciated.
You can hide close and done button in other view like this
[closeBtn setHidden:YES];
[doneBtn setHidden:YES];
Make sure your other class able to access these buttons
if YOu Use PHONEGAP, you must use AppInBrowser
you can code like this
a href="javascript:void(0)" onclick="open_pdf('your.pdf');"
function open_pdf(url)
{ var ref = window.open(url, '_blank', 'location=no'); }
Follow :
Here's a link! And a reference-style link to [a panda][1].

Handle copy: paste: cut: in UIWebView

How to hadle copy: paste: cut: events in UIWebView?
As Apple says, we can not subclass UIWebView,
so how can I handle UIResponderStandardEditActions?
Maybe someone faced with such a difficulties...
I need to implement custom copy,cut,paste in order to copy/paste html (RTF text, some custom html elements).
In addition, I have 2 webviews, so if I paste some elements in one, another one should reply for this interaction.
Unfortunately, I think you are going to have to make your own copy/paste menu.
Using the answer from this question you can set up custom copy/paste buttons, and you could handle everything you are trying to do through those:
[[UIApplication sharedApplication] sendAction:#selector(cut:) to:nil from:self forEvent:nil];
Also, this question shows how to make a custom UIMenuController and use the UILongPressGestureRecognizer to get it to show up on the UIWebView.
I hope this helps. Someone else may know an easier way, but I think this way will work at least.

Black temporary alert box in iOS

I need a black temporary transparent box that must show something like "Loading...." with a spinner it. We can see such a view in twitter when "Tweeting" an update - it says "Sending tweet..." kinda thing.
Is this an inbuilt behavior in UIKit. How do I get this box to show up on screen for a few seconds and disappear.
please help.
You need to use DSActivityView. All this is handled there. Instead of doing your own thing I suggest you use this.
For what you need this is how you need to go -
#import "DSActivityView.h"
[DSActivityView activityViewForView:self.view withLabel:#"Tweeting"]; //to show spinner with label
[DSActivityView removeView]; //once its done
You can also try using MBProgressHud

Resources