Following JavaScript call function not working in googleweblight
<i class="fa fa-facebook"></i> Facebook ID
or
<a onclick="FBLogin()" href="#" class="btn btn-sm azm-social azm-btn azm-facebook"><i class="fa fa-facebook"></i> Facebook ID</a>
What may be issue? is it possible to fix it?
For a example
http://jsfiddle.net/zalun/Yazpj/1/ It will work,
but same link wont work in
googleweblight http://googleweblight.com/?lite_url=http://jsfiddle.net/zalun/Yazpj/1/
Javascript seems to be disabled in googleweblight, if you want to see in detail then you can look at your site by this
http://googleweblight.com/?lite_url=[your_website_URL]
example http://googleweblight.com/?lite_url=https://stackoverflow.com/
Well, you can opt out of it but in such case google will label your page in the search results to indicate to users that non-transcoded pages may take longer to load and may use more data.
You can find more details here
https://support.google.com/webmasters/answer/6211428?hl=en
Related
I'm trying to make a menu for my app, and I'm trying to avoid repeating the same HTML code, so I want to put some data into array and loop it. It works fine for text, but I'm having trouble passing Bootstrap icons which are written in <i> markups.
I'm working on an MVC .NET project in cshtml file.
Here is what I have:
#{
string[] menuItems= {"Clients"};
}
<a class="nav-link menu-item" asp-area="" asp-controller="Calendar" asp-action="Calendar">
<i class="bi bi-people-fill clients"></i>
<span class="menu-item-text">#menuItems[0]</span>
</a>
And I'm trying to achieve something like this:
#{
string[,] menuItems= {"Clients", "<i class="bi bi-people-fill clients"></i>"};
}
<a class="nav-link menu-item" asp-area="" asp-controller="Calendar" asp-action="Calendar">
#menuItems[0,1]
<span class="menu-item-text">#menuItems[0,0]</span>
</a>
Is there a way to make HTML read the string as part of the code?
By default any text being emitted from the server is HTML-encoded. You can bypass this by using Html.Raw():
#Html.Raw(menuItems[0,1])
Note that this should be used with caution, because if you use this to output anything that's provided by user input or in any way editable by users then you are exposing your users to security risks.
This could be a good opportunity for you to investigate other ways to achieve the same functionality without this potential risk. For example, you could already have the markup in the view and use the dynamic data to show/hide the markup. Or not even rely on server-side code at all and style/change menu items client-side.
I use this code below: (Django python)
<i class="fa fa-sign-out"></i> Logout
and when I click on it, nothing happens. But if i open it in a ne tab, google chrome says about:blank#blocked. How do I fix this
As far as I understand your problem is caused by usage error.
<script>
function myFunction() {
document.getElementById('logout').submit();
}
</script>
<i class="fa fa-sign-out"></i>Logout
It should work that way.
I tryed to use href but its only redirected me to a web player.
<span><a download class="btn btn-action ml-auto mr-4 btn-sm waves-effect waves-light" download="audio.mp3" onclick="downloadMusic()" style="background-color: #F50057;"><i class="fas fa-download pl-1"></i></a></li></span>
function downloadMusic() {
location.href = audiolink;
}
Welcome to Stack Overflow!
There isn't much reason to use JavaScript here unless you wanna change what location of the audio file is depending on some other statement. If so, you'll have to change the button to that new audio link before the user clicks on it, the JS to change the link would be something like:
function setDownloadLink() {
document.getElementById('downloadbutton').innerHTML = 'Download'
//You would need an element around the hyperlink with an ID, then you replace 'downloadbutton' with that ID.
}
If you're not wanting to have it update along with other JavaScript, then you can just do something like:
Download
So I'm trying to get a certain link of a button on a website I parse via NodeJS:
Usually, it would be fairly easy when using cheerio:
$('.panel-default').find('.btn-default').attr('href');
The problem is: There are 3 other buttons with the same classname, on overall 60 items:
<span class="fa fa-fw fa-steam-square poptip" data-toggle="tooltip" title="" data-original-title="View Details"></span>
<span class="fa fa-road fa-fw poptip" data-toggle="tooltip" title="" data-original-title="See more like this"></span>
<span class="fa fa-link fa-fw poptip" data-toggle="tooltip" title="" data-original-title="View shareable link"></span>
So looping through the 4 results with .each, picking the right one, and repeat that on all 60 other items don't seem like an elegant choice for me.
Is there any other way to grab the wanted info, for example by calling the unique data-original-title "Inspect in game" via cheerio (is that even possible?) for example? Or how else could this be solved in an elegant and smooth way?
If $('.panel-default').find('.btn-default') return more than one value, you can pass index that you want to get just her href attribute.
If you want the second element href by example :
$('.panel-default').find('.btn-default')[1].attr('href');
Use the data selector.
$('.panel-default').find(".btn-default[data-original-title='Microsoft']").attr('href');
I've the following issue: I've build a quote generator (freecodecamp) and need to be able to share the quote via twitter. My approach was via Twitter web intent and the text is the data I receive via the API. It only works once.
HTML:
<p>Share the wisdom</p>
<a class="twitter-share-button" href="#" target="_blank">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-twitter fa-stack-1x fa-inverse"></i>
</span>
</a>
JS:
<script>
function myFunction() {
var firstName = document.getElementsByName("firstname")[0].value;
var trumpAPI = "https://api.whatdoestrumpthink.com/api/v1/quotes/personalized?q="+firstName;
$.getJSON(trumpAPI, function(data, status){
document.getElementById("trump").innerHTML = data.message;
$('a[href="#"]').attr("href","https://twitter.com/intent/tweet?text="+data.message+"&hashtags=trump, quoteoftheday");
});
document.getElementById("trump").classList.add("border");
}
</script>
Could it be that the text parameter in the web intent is not dynamic? Any suggestion how to fix this? thanks in advance.
I have to guess a little bit because you didn't share your complete functionality, I assume what you do is this:
You have a button of some sort, clicking which will get another quote.
Clicking that button calls your myFunction().
If that's correct, then the problem is that your <a> element no longer has href="#" after the first time the function has run; the href is now the intent link. And because of that, $('a[href="#"]') no longer selects that link on the second call. If you use $(".twitter-share-button") instead, it should work.