I am using ShareThis widget in my website, here trying to customize some of the functionality of the email widget shown below:-
Currently when you hover on this email icon, a dialog box appears:-
What i am trying to do is, making the popup disable for the icon and implement a url which takes me to a specified url let say http://www.google.com...
I also try to add window.open to the span:-
Before:-
<span class='st_email_large' displayText='Email'></span>
After:-
<span class='st_email_large' displayText='Email' onClick="window.open('http://www.google.com'); return false;"></span>
But unfortunately my all ideas have been so far waste, their is no responce from onclick javascript? Any solution for this?
This code snippet works for me when I type it in the Javascript Console on the sharethis.com Website:
// Disable Sharethis popup
$(".st_email_large")[0].onclick = null;
// Load url instead
$(".st_email_large").click(function() { window.location.href = "http://google.com"; });
You need jQuery for it though.
Related
To send users to different links, I use a JS function that when called, creates an animation, times out for a bit and then location.href the user, the problem is that if a user does not have JS enabled, he will not be redirected to the site. Is there any way onclick wold redirect the user normally if he does not have JS enabled and redirect it with my function if JS is enabled?
Thanks is advance!
You could try creating the element with both href and onclick attributes. Then, in your JS, set the href attribute to "javascript:void(0)".
Code would look something like this:
html
<a id="jsElement" href="/newPage.html" onclick="callFunction()">Text</a>
javascript
window.onload = function() {
document.getElementById("jsElement").setAttribute("href", "javascript:void(0)");
}
In my application navigator status bar is displayed by default at the bottom of each screen and URLs linked to buttons and icons will be displayed on it.
Like this:
I do not want to show URL associated to hyperlink or button at bottom of the web page using JavaScript.
What I have tried so far:
Setting window.status = '' onmouseover property of hyperlink/button, but this is not working.
Browser I'm using are Internet Explore IE11 and Firefox 38.8.0.
Try this
It's working for me.
I have tested this on both browsers: Internet Explore and Firefox
click here
I do not want to show URL associated to hyperlink or button at bottom of the web page [using JavaScript]
Statusbar shows the href.
So: don't specify an href.
There's no need for javascript to "hide" it.
Given that it's a link you probably want to be able to click it, so add a click handler with jquery and you can style with css to make it look like a link.
$(function() {
$("#saveLink").click(function() {
location.href = $(this).data("href");
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<a id='saveLink' title='Click to save' data-href='http://google.com'>no status bar link on hover</a>
<br/>
<a href='http://google.com'>link shown in status bar on hover</a>
If you need keyboard support (tab) then you'll need an href, so can just go with href='#'
Right now I am using a javascript to trigger a new tab and load a new page in the parent window. It looks like this:
<script type="text/javascript">
function openOtherLinks(id1, id2) {
var link1 = document.getElementById(id1);
var link2 = document.getElementById(id2);
if(!link1.href || !link2.href)
return;
window.open(link2.href);
document.location.replace(link1.href);
}
</script>
<img class="aligncenter size-medium wp-image-94" src="x" alt="x" width="200" height="43"/>
<a id="link1" href="url1"></a><br/>
<a id="link2" href="url2" target="_blank">`
This triggers the "same" page in a new tab on click (works fine).
The problem is that I want to trigger a popup on click, I´ve tried several plugins for pop-ups without any success. Is it even possible to trigger a popup after loading the page in a new tab?
The pop-up im talking about is a pop-up for that very link. It is going to show a coupon code. Therefore I can not trigger the pop-up on a specific url since the url/page contains several campaigns with different coupon codes.
I´ve seen this type of solution in multiple webpages but can´t figure out how
they´ve done it. The easiest solution would be to simply add a popup #id in the end of the url to trigger the popup but I haven´t found any plugin that works this way.
btw, im talking about "in page popups". Not a new window.
I have made a email functionality in a custom view using JavaScript. The problem is on clicking the send email button in list view it goes to this window and previous window is gone. I want my custom view for emailing to popup just like the default quick response email, that pops up when we click Email button in quick action menu in leads module in SugarCRM. Can anybody suggest how it could be done.
Open the Popup in a new window with a defined size using javascript
function popup (url) {
foo = window.open(url, "Popup", "width=400,height=300,resizable=yes");
foo.focus();
return false;
}
or take a look at JQuery Dialog
I am implementing a form which has got links in it,
like this:
<form>
<a>FAQ </a> /* something this way */
<submit button>
</form>
I have to display a confirmation box to the user, if the link is clicked and only when it tries to load the href. In case the user is opening the link in new tab or uses 'CMD-Click' (Mac), the prompt must not be shown.
In Firefox, the browser itself takes care of this when the user tries to navigate to another page when he is in the middle of the form, but I need this functionality to work in all browsers.
Does anyone know how to do this?
that's simple
Google
but i'm not sure if CMD+Click doesn't alert the user. Most of these event can't be controlled by javascript as they are coded into browsers.
Maybe something like this? demo
<form>
FAQ /* something this way */
<submit button>
</form>
$("a").click(function() {
if (!confirm("Do you want to leave?")) {
return false;
}
});
As for not displaying on new tab/new window, there are no such javascript events, thus you cannot capture them.