Need to click a link in other site.
<a href='https://www.google.co.in/search?client=ubuntu&channel=fs&q=apple&ie=utf-8&oe=utf-8&gfe_rd=cr&ei=ZV-9WJLODa2l8weF86joBg'/>
Above anchor tag will open the google search.
But i want to open the first search result automatically.
Is there any way to inject the Jquery(to open first search automatically) while user clicking the link
No, that's not possible, and that's a good thing. Just think about the security implications if this were actually possible: anyone could remote control your browser to click on any link they want.
Related
I'm trying to implement the following feature:
You are on website A
You open a link with target=_blank that goes to website B, in a new tab of course
On website B, there is a link that will make refocus on tab for website A.
Please note that I'm developing both websites and both are in Angular. Is there a way to implement this?
The purpose is not to lose the website state, otherwise I could just redirect the user by the website urls, however I'd lose state.
Thanks in advance!
There is no way to perform such action in JS, it would be a nightmare for everyone.
But... link on website B can just be a window.close()... Previous one will be re-focused.
Is it good for you?
You can't change the browser tab that the user is looking at, due to security concerns. Instead, consider redirecting the user and persisting the data in some appropriate way (e.g. a service)
I have a question which I haven't been able to find the answer for. I hope you can help me.
I am about to build a simple website, containing text and hyperlinks. I want the site to have the same adress no matter which hyperlink is clicked. For example, if my website is www.website.com - when one clicks a hyperlink, the content of the whole page should change, but the adress should still be www.website.com, instead of www.website.com/hyperlink.html for example. In other words, I want to disable people to use the "back" button to return to an earlier page, and prevent them from navigating the page by writing in the adress bar. They should experience a single page, but still be able to navigate through a lot of changing content through links - which means that if they click the "back"-button, they will be navigated away from the website, and if they refresh the page, it will go back to 'index'. Can you point me in the right direction to which methods might be useful here? Earlier, I would have done it in Flash, and embedded the flash-construction into the website, but as far as I have heard, Flash is not the best solution anymore?
Thanks in advance.
First of all, that is not the best idea for SEO.
But that puts aside, you should use javascript to make AJAX call and alter the partial part of your page with the response.
So basically, what you will do is from your home page, capture all link clicked event, and process the request through an AJAX call, and display the result of that call on the same page.
That allow you to refresh a list of item, or a menu, or the entire page if you want.
Since it will be AJAX call, the user won't see any difference in the URL.
the requeirment is that I want to avoid the specific web page to save to bookmark,
and is there someway to acheive this funcion just use some code, maybe add or js code . thanks
The answer is no, the user can always bookmark a page as this is browser function, but you can use sessions. Then make sure that any request for a page
must have an active session id or it returns an error or redirects to the home page. The user can bookmark the page but the bookmarks will then only work for a short time (until the session expires). This also has the added benefit of
making the site impossible to index by search engines.
The closest you're going to get is if you open another window using JavaScript as you can control whether the menubar and toolbar are displayed.
window.open(
"https://www.google.com/",
"Google",
"resizable,scrollbars,status");
However, this is likely going to be blocked by their popup blocker.
I am creating a site which makes use of youtube videos, but I don't want to use the embedded player, I want to just have a youtube page in an IFRAME. I read the youtube TOS and I am not sure whether IFRAMES are allowed other than the embedded player so taking no chances I think I will build the site to open links in new tabs instead. What I would really like is to be able to open new links in just one tab. To clarify, my site is tab 1, once a link is clicked youtube opens in tab 2, any further links clicked on my site replace the content in tab 2, and no more than 2 tabs will exist.
YouTube and some other high-profile websites block the use of iFrame for security reasons. So if you used an iFrame, it would just load blank.
To open a link to a new tab you would use:
Open me!
I'm not entirely sure that you can control which tab to then replace with further content.
My suggestion would be to do this:
1) Create links to pages with videos embedded in them, with target="_blank".
2) When a user clicks the link, capture it with Javascript (perhaps jQuery) and open the contents of that within some kind of modal overlay like Shadowbox ( http://www.shadowbox-js.com/ ).
This way, the user stays within the same window, without the need for iFrames or new tabs at all. If the user has JS disabled, they'll then get a default "new tab" behavior.
Good luck.
I don't think you control that what you want very easily, and if you can find a hook for this, it most likely is not cross-browser. I'm open to a better suggestion but I think you could use javascript window.open(URL, windowName[, windowFeatures]) and use the same name every time you call it. Then it will replace the previous window. It just will not open in another tab but in a popup.
You cannot control a webpage in another tab and neither can you limit the no. of tabs a browser can open for obvious reasons of security. Limiting the no. of tabs that can be opened or controlling without user's intervention would definitely be considered hacking, bowsers don't allow that.
When you hover over a hyperlink you see in the corner of your browser the url you're gonig to. I'm using javascript to navigate through my tabs div. When I hover over the tab I see the url. I would like to hide this. Is this possible?
Link to example
Don't do it! Clients like to see where links are going. This behavior isn't up to you.
The only thing you could reasonably do is set the link to go to nowhere, and set the onclick attribute with sourcecode that does a window.location.
If you don't use the "href" attribute, the link won't show up.
Simply do this:
<a id="tab1">Tab 1</a>
$('#tab1').click(function(event) {
switchTabs();
});
This will register a click event (using jQuery) on the link without displaying any URL to the user. This is the proper way for handling links that don't redirect the user.
Hide Text
Then in that function you can have a switch case statement which uses window.location to send the user to another page.
Downsides to this include alienating your users which disable Javascript, and search engines probably won't follow this link.