I would like to make a google chrome extension. I want to add a function, so when i click on it's icon, it will open a new tab with a specific URL. How can I do that?
Sorry for bad english, I'm just learning that language ;)
If you want to open a link in a new tab when you click on a page action icon you can use the onClicked method of the pageAction: http://code.google.com/chrome/extensions/pageAction.html#event-onClicked
So, in the background page or script add the following lines:
chrome.pageAction.onClicked.addListener(function(tab) {
windowObjectReference = window.open("http://google.com/", "DescriptiveWindowName", "resizable=yes,scrollbars=yes,status=yes");
});
Note, that onClicked event is NOT fired when page action has a popup page that is displayed when page action is clicked. So in order to use onCLicked event you should NOT have a page action popup page
Related
I am Using Vaadin Framework in my application. I want to open a popup screen using Vaadin Link. I know to open popup thrugh button but I need to open popup through Link. Can anybody help, this is my code:
Link link1 = new Link(String.valueOf(rs.getInt(1)), new ExternalResource("#"));
_reportTable.getItem(dashboardDataRowId)
.getItemProperty("todo").setValue(link1);
As explained in in Book of Vaadin - Components - Link, Link should be used only for hyperlinks to external resources, as it is nothing more than a wrapper for a anchor html tag and as such it does not fire any server side events. As a result you cannot react on server side to open a popup window or do some other logic.
The Link is a regular HTML hyperlink, that is, an anchor
element that is handled natively by the browser. Unlike when clicking
a Button, clicking a Link does not cause an event on the server-side.
What you really want is vaadin button styled as a hyperlink. You can do it by creating a regular button (which supoorts server side events and can open your popup) and then adding an appropriate style.
Button linkButton = new Button();
linkButton .setStyleName(BaseTheme.BUTTON_LINK);
Always be sure to call addStyleName() instead of setStyleName() as it only adds your new style to the list of other styles already present and it does not override that list with your only new style.
So I have a page and a dialog. When the user click the page button, one AJAX request will open the dialog with the results. Something like that simple example without AJAX: http://jsfiddle.net/rBBpx/
It works. The dialog opens programatically. But it hides the page content, showing the dialog as if it's another page. I know that popup's can open dialogs in-page with links, but I didn't get the point in how I can do that programatically.
I tried to change $.mobile.changePage() call to that, but it didn't worked as I expected:
$('#dialog').popup();
$('#dialog').popup('open');
How can I show that dialog in-page, as a popup? Is it ever possible? Thank you in advance!
In case you use phonegap, there is an alert plugin: http://docs.phonegap.com/en/edge/cordova_notification_notification.md.html
navigator.notification.alert("your AJAX result here");
I have a button that when pressed opens a window on the screen
Is there a way I can get the window to open automatically with a URL?
An example of this site http://karevn.com/ have the button FEEDBEACK
I want the window will open only with a command URL
The site you mentioned is using this plugin -> http://wordpress.org/extend/plugins/usernoise/
However the plugin is not upto date so just test it before using it on yours taking a back up copy of the files/database.
karevn use a jquery plugin like the FancyBox ( see the ajax part or iframe in this page http://fancybox.net )
Open a window with a hyperlink
How to open a new window when clicking a hyperlink?
If you want the feedback button then
http://www.script-tutorials.com/css3-modal-popups/
Goodluck
I used some open resource to handle my external links in WebView, so right now every time I click the url a new view would show the page with "Done" "back" "forward" "open link in safari" something like that. But at the same time the earlier webview of my app is still loading and show the url website. How could I stop it? When the user click Done for the new page, definitely they want to go back to the earlier page.
here is the open resource class I used : https://github.com/samvermette/SVWebViewController
Thanks. wish I made myself clear. I'm new here, and also new to ios development.
Not entirely clear what you're asking but every time a link is clicked in a UIWebView, the UIWebView delegate shouldStartLoadWithRequest method gets called.
If you don't want the link to load you simply return NO from this method.
There are also properties in the UIWebView class to enable you to go back or go forward through the page history.
If that doesn't answer your question, can you try and rephrase it.
I am writing a PhoneGap app using JQuery Mobile.
I change pages based on buttons and links that are clicked within the app. All of my views are encapsulated in a single index.html page. Different pages are broken up by div data role like so:
<div data-role="page" id="view1"></div>
<div data-role="page" id="view2"></div>
When a button is clicked the app moves the next view with:
$.mobile.changePage("#search2_1");
The problem is when a user is typing in a text box. The keyboard pops up with either the "Go" or "Search" buttons available. If the user clicks this, they bypass the javascript function that moves them to the next page and are inadvertently sent back to the root of the app.
Is there anyway to disable or remove these buttons or even have these buttons trigger the change page function?
*note: since this is a PhoneGap app I am limited in what I can do in Objective-C and I am focusing on doing this within the web page.
Since your elements are inside a form element the user submits the form by pressing the search or go button, which will reload the page.
you need to cancel the form submit.
This would look something like this in jquery:
$("yourform").submit(function(){
return false;
});
To answer the second part of the question, this is what I did:
$('#form').submit(function(e) {
e.preventDefault();
$('#button').trigger('click');
return false;
});
This prevents the default submit, and instead triggers the action you want.