I am trying to add to my Tumblr page a way for when a youtube video or a SoundClouds is clicked, it shall open into another window. I am unable to figure out how to do this.
Here is a example of them code I am using for SoundCloud
{text:Link Two Title}
If you want it to open in another window, why don't you link to it instead of using an iframe? Using a iframe is for when you want it specifically within an area of the same window.
Try something like this:
Setting the target attribute to _blank should open the link in a new window.
Go for an anchor tag i.e.<a>
This should solve the issue.
See the code below:
<html>
<body>
Sound Cloud
</body>
</html>
Hope this helps
Related
I'm trying to open web url what is hidden in elements, but if i click on button what in on web page, it shows up in the elements.
So want to use javascript, when i click on button, then javascript find that url and open it in another window.
I want to use tampermonkey, the userscript manager to run that script.
Iam new to coding, except wrong code.
I already tried some commands like this: document.getElementById("vjs_tech")
it shows up like <video *there are some random* and src="https://and some random words"></video>
and i tried use method window.open("src").
document.getElementById("vjs_tech");
window.open("src");
I excepted that will open the link from src but it only opened same window again.
You have to take the value of src attribute from the element.
var videoURL = document.getElementById('vjs_tech').src;
window.open(videoURL);
I made a simple Chrome Extension that, when clicked, has a dropdown menu that has a row of icons. Is it possible to set it so when the icon is clicked, it opens its respective website in a new tab?
(NOTE: I have tried to make it refer to a link in the popup.html file, but if I click on the icon, it doesn't do anything.)
Any help, suggestions or advice is greatly appreciated, thanks!
You need to assign a click handler to the icon that executes the following:
chrome.tabs.create({url: websiteToOpen});
If you want it to open in the background without closing the popup, one more parameter is required:
chrome.tabs.create({url: websiteToOpen, active: false});
Do note that "tabs" permission is not needed for this.
This example from Chrome docs shows how to properly assign a click hanlder in a way that's compatible with Chrome extensions (onclick attribute will not work)
#Xan
Hey, thanks for your answer and sorry for the late reply... I figured it out though, and I didn't need to add any click handlers... I just did:
<a target = "_blank" href = "http://google.com">
<img src = "http://upload.wikimedia.org/wikipedia/commons/a/a0/Google_favicon_2012.jpg"/>
</a>
the target attribute says to open it in a new tab and it does exactly that when I click on it. Problem solved! Thanks!
Long story short: (tried looking this up to no avail; maybe not wording it right? newbie here).
I'm working on a mobile-friendly webpage. On this webpage is a button. When you click said button, it takes you to ANOTHER webpage with a video on it.
The desired effect I'm looking for is when you click on the button, it doesn't take you to the new page, but rather opens up the video on the spot.
Is this achievable? Thank you in advance.
I have created a jsfiddle, see below, so that if you click on the button, it loads the video without bringing you to a new page as you requested.
http://jsfiddle.net/yb6s7fud/
Here is the jquery code I used:
$(document).ready(function () {
$('button').click(function () {
var video = '<iframe src="https://www.youtube.com/embed/koJlIGDImiU?autoplay=1"
frameborder="0" allowfullscreen></iframe>';
$("#video").append(video);
});
});
Hopefully this is what you are looking for.
With youtube you can easily open the video in a modal box.
With other webiste you can open a iframe modal with the entire page content. You can affect iframe with jquery to take only the video only if the other page is the same domain.
Have you tried creating a container with the right properties so inside you can place an iframe? The button should be the anchor to the iframe source.
Im stumped..... I'm using Fancybox jquery plug in to display some iframes over the top of my page in a lightbox style.... i have it all working but if I try to link to an external website from within the lightbox using the normal somesite
I before you suggest it I have tried target="_blank"with no luck.
it opens in the lightbox not in the original window, I dont mind if it opens in a new tab or windows I just cant have it opening in the lightbox... has anyone else experienced this before?
Just to make sure that I have understood the scenario here -
You have a link that when clicked, opens the content in a fancybox pop-up.
This content has some text and within that, it has a somesite link. You have also tried target="_blank".
When this <a>..</a> is clicked, it should act like a normal link and open in a browser (new tab or window). But it opens the this link in the fancybox pop-up instead.
If that's the case then I tried it and the link opened in a new tab.
Please clarify the above doubt of mine.
Thanks.
Try target="_parent" instead of target="_blank"
See following example:
somesite
Normally we can specify a target in the link or use javascript window.open to open a new window.
But when I access this site
www.wenxuecity.com (It is a chinese site)
I could't find out how it opens each news in a new window.
no target in the link.
debug javascript doesn't show any call to window.open
Could someone tell me how it is implemented?
Thanks
It has this code in the head section:
<base target="_blank">
That sets the default target for all links on the page.