How to disable navagation on the URL Bar - android

How do I make it so when a user clicks on my website button, it doesn't add on the the URL bar, for example, when they click on a button it will open a modal box, example.com/index.html#modalopened but I don't want that to show, I want it to only say example.com/index.html instead of the # stuff....
I tried onClick="return false;" but it made it so the button didn't work at all... :(
Any other suggestions?
Also, maybe its just easyer to disable it totally, so that when people visit the site it just says example.com instead of example.com/index.html :)

You can use angular.js to dynamically update page content without changing the URL. https://angularjs.org/
Also by using a .htaccess (depending on what webserver you're using) you can get rid of the /index.html, too and have something like http://example.com/

Related

Android: TextView enable links but open them inside the app

I know how to open URL links inside the app (I use FinestWebView).
Also, I know how to make URLs in a TextView clickable (android:autoLink="web").
But I want to "combine" these two things, i.e. I want a URL link in a TextView to open inside the app when I click on it.
I didn't find anything on this, so: How can this be achieved?
Do you want the link to be open from the webview!?
Just make it clear . Or provide some of your code stuffs..so that it can be easy to help yu

How to programatically save website title and URL for speed dial buttons like opera or Firefox?

I'm creating a browser with a start page and edittext that that directs you to the actual browsing section of the app when a URL is entered. On the start page I also have 5 working static speed dial keys in a gridview. I have placed an add button which opens a dialog box with two edittexts, one for the title and one for the URL along with two buttons, create and cancel. After getting this far I'm stuck. I tried to add another Room database and tried to set it up similar to how I have my tabs but that didn't work at all. I think I need to somehow be able to dynamically add an image button that saves the website URL and title and possibly grab it's favicon. At this point at least the button, title and URL, and I can figure out the favicon later. Can anyone give me a little insight as to how this would work? I can post code if needed.

Making Edittext an address and search bar in one Android Eclipse

I am trying to make an edittext into both a search bar and address bar. Also I am not sure how to allow the user hit enter on their keyboard to initiate the search instead of manually touching the go button.
It sounds like you want to use IME actions for your case to allow the user to have a sort of "Go" button which is activated by the enter key. This page on the official Android guide should help you: http://developer.android.com/guide/topics/ui/controls/text.html#Actions
To detect a URL, use the built in Java class to do it. See here: How to detect the presence of URL in a string
Using those two methods, simply check if the entered text is a URL. If it is, then use it, otherwise you call your search method passing in the entered text.

How to make a clickable button (image changing when clicked) in an html displayed by android and iphone webviews

I have a webapp for android and iphone that uses a webview to display a web page.
The page contains a graphic button implemented this way:
<INPUT id="OkBorder" type="image" src="ok_off.png" border="0" onclick="OkClicked()">
I would like users to see a click effect (image on button changes to ok_on.png then back again to ok_off.png) just before redirecting them to a new page.
I tried to use :
function OkClicked()
{
button = document.getElementById("OkBorder");
button.src = "ok_on.png";
}
but i don't see the image change when i click it...
Is there a way to show a button click effect this way in a webview ?
I don't think button.src is right because the src is not a javasript command. Is this what you wanted to do, if not then you might want to try d. Other sites seem to use hidden and visable which you might want to try.

Creating a custom action on text link

This is seems like a pretty simple question, but I'm not sure if there's a solution to it. Is it possible to set a custom action for a text link (those blue texts that are underlined) inside a TextView? In other words, is it possible to have a handler do something on an event like onClick on the link?
You need to set the link in the text, and use the autoLink attribute for it. It will use the marked text as link. Otherwise, the only option is to use an OnClickListener as suggested by nicholas.
You can look at the autoLink attribute doc here: http://developer.android.com/reference/android/widget/TextView.html#attr_android:autoLink
If your text is: "You will find it at http://www.example.com", and you set android:autoLink="web", then the link will be highlighted and a browser will start after clicking it.
If you are working with an EditText or a TextView, they both have an setOnClickListener() method which you could override.
If you are working with a WebView, and the content created is yours, you can use JavaScript to handle click's of links.
If you are working with a WebView and the content you are viewing is not yours, I am not sure if there is a way to intercept those, but you should still be able to call setOnClickListener() on a WebView, as setOnClickListener() is defined in the View class. I am just not sure how you would tell whether or not a link was clicked in that WebView...
I encountered this situation too, where I have autolink set up in TextViews to automatically handle URLs in TextViews. However, the default behavior is to open the web page in an external browser, so how do we make it open in an in-app browser (for example)?
Underneath the hood, this is handled for TextView by LinkMovementMethod. Hence, the suggestion (by one of the answers) to customize onClickListener() of the TextView is not ideal, as it would involve reimplementing much of what LinkMovementMethod handles, so that it could precisely handle clicks/taps on what are identified as URLs.
More recently (years after this post was made), someone has come up with an enhancement over LinkMovementMethod, known as (what else?) BetterLinkMovementMethod, described in more detail this blog post. I can confirm that it did work for me. With just a few lines of code changes, the TextView autolinks now open in the in-app browser (and clearly, all kinds of other behaviors can be customized as desired). I have no affiliation with BetterLinkMovementMethod or its creators, but am just a grateful user.

Categories

Resources