Get Button Click Link - javascript

Is there a way to get the link of a button click in a website?
This is the Website
https://onlineradiofm.in/stations/mirchi and there is a play button. I want the link to the play button click so that everytime i open the link, the audio starts playing automatically.
Is there a way to achieve this?
Any help is appreciated

Add jquery code in the page where you want to click the button on page load.
<script>
$(document).ready(function()
{
$("#button-id").trigger("click");
})
</script>
Replace button-id with your button id.

There is no link in the play button, it's a click event. The solution to your problem may differ a lot depending if you own the site you are trying to redirect to the audio or not. In case that the website is owned by you, then you could just create the link you are asking for playing with query string parameters to execute a Js script that clicks the button (like the one proposed by #Pranay kumar 's answer). If you don't own the specified website, then its much harder. In this second case, you could make a python script that clicks the button. An example that may guide you to this solution can be found here. This should work in your case, but the solution would not be a link, it would be a script.

Related

How to add a button on the embedded youtube video?

I want to add a button on the embedded youtube video on my website. So that a user can easily download that video. Now I just need to display a button on youtube video surface ,so that a user can click the button and do some job (about the video). Button will be like this:
Click Here to see
with simple html or javascript. Thank You.
Adding a button on top of your iframe is the simple part of the solution, and you will likely find this solution helpful. to match the styling, I'd recommend a site like http://css3buttongenerator.com/
As for the second part of this question, it is more advanced to write javascript to download a video, and if you'd like to avoid that, a simpler solution would be to redirect a user to a site like this. you could even go through the steps of downloading the video, and get the final link the site provides when it is ready to download.

How do I click a link and make the game pop up in a certain area on my page without showing till clicked

I'm trying to figure out how to make a link on my page access a game in a certain spot on the same page. I have multipal games that are embeded>. So I have multipal links on the same page.
So Basically after I click one of the links, it will do a pop up in any area next to the link and they can play it. If someone can help me out I will give you much credit needed.
I'm using antenna web design and I'm not sure if I need to call functions so I can put the code in a certain area. Thank You For Your Time If You Help.
if you need in the same page means use
<iframe></iframe>
otherwise just make a link. it will open same window or use target="_blank" it will open for a tab
try to send the video Id in link and filter the video id from querystring on click event

How do you hide the URL when you hover a hyperlink?

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.

How to simulate a click tag in a flash banner

Our sales people accepted flash banners without a click tag and then scream in anger when our ads server (openx) didn't count correctly the clicks.
So, I'm looking if exists some way of "simulate" a click tag, I don't know exactly how, maybe with some JavaScript.
You could put a blank <span> or <div> element in front of the embedded flash, and then use a JavaScript event listener to open the desired URL.
Just pass the link as a variable to your Flash movie in the embed code.

Using the BACK button to revert to the previous state of the page

I am trying a new functionality for my web site. I want to do simple navigation by hiding/showing <div> elements.
For example, when a user clicks a "details" button on some product, I want to hide the main <div> and show the <div> containing the details for the product.
The problem is that to go back to the previous "page", I have to undo all the display/visibility style changes, which is ok if the user clicks the "close" button in the newly opened <div>. But most users will hit the BACK button.
Is there a way to make the BACK button go back to the previous "state" of the page i.e., undo the visibility/display changes?
Thanks.
Yes. What you're looking for is called AJAX browser history.
There are a few open implementations out there, like RSH as well as plugins/modules for frameworks like jQuery and YUI.
to answer the question of your title (that's what I was looking for)
Using the BACK button to revert to the previous state of the page
and from the link from #reach4thelasers's answer, you have to set up a timer and check again and again the current anchor:
//On load page, init the timer which check if the there are anchor changes each 300 ms
$().ready(function(){
setInterval("checkAnchor()", 300);
});
because there's no Javascript callback triggered when the BACK button is pressed and only the anchor is changed ...
--
by the way, the pattern you're talking about is now known as Single Page Interface !
You need to add an anchor to the URL whenever a change is made
www.site.com/page.html#anchor1
This will allow the browser to maintain the pages in its history. I implemented it in my current site after following this tutorial, which works great and gives you a good understanding of what you need to do:
http://yensdesign.com/2008/11/creating-ajax-websites-based-on-anchor-navigation/
Your example in the comments won't work, because it works like this:
Page Loaded
Page Changed, Add Anchor to URL (back button takes you back to back to 1)
Page Changed, Anchor Changed (back button button takes you back to 2)
Page Changed, Anchor Changed (back button button takes you back to 3)
.... and so on and so on..
If there is, it sounds like a pretty evil thing to do from a UX perspective. Why don't you design a "back" button into your application, and use design to make it obvious to the user that they should use your application's back button instead of the browser.
By "use design," I mean make your application look like a self-sufficient user interface inside of the browser, so the user's eye stays within your page, and not up on the browser chrome, when they are looking for controls to interact with your app.
You can do this with anchors, which is how it's done in a lot of flash applications, or other apps that don't go from page to page. Facebook uses this technique pretty liberally. Each time the user clicks on a link that should go in their history, change the anchor on the page.
So say my home page link is:
http://www.mysite.com/#homepage
For the link that works your javascript magic, do this:
My Other Page
This will send the user to http://www.mysite.com/#otherpage where clicking the back button will go back to http://www.mysite.com/#homepage. Then you just have to read the anchors with
window.location.hash
to figure out which page you're supposed to be on.
Take a look to this tutorial based on ItsNat a Java web framework focused on Single Page Interface web sites

Categories