Detect flash plugin from Javascript - javascript

http://www.javascriptkit.com/script/script2/plugindetect.shtml
I am trying to detect flash plugin with Javascript from the above url, but the code doesn't seem to work for IE. Am I doing anything wrong here?
I just need to see whether the flash plugin is installed on the browser or not.
if (pluginlist.indexOf("Flash")== -1)
{
alert("You do not have flash player plugin installed.Please install flash player");
window.location = "/home";
}

swfobject is the established quasi-standard for dealing with flash in JavaScript.
There's a tutorial for Detecting Flash Player versions and embedding SWF files with SWFObject 2

i too tried the same flash plugin but in different link. I tried the following javascript code:
<script type="text/javascript" src="swfobject.js"></script>
<div id="flashcontent">
This text is replaced by the Flash movie.
</div>
<script type="text/javascript">
var so =
new SWFObject("movie.swf", "mymovie", "400", "200", "8", "#336699");
so.write("flashcontent");
</script>
Prepare an HTML element that will hold our Flash movie. The content placed in the ‘holder’ element will be replaced by the Flash content, so users with the Flash plug-in installed will never see the content inside this element. This feature has the added bonus of letting search engines index your alternate content.
var so = new SWFObject(swf, id, width, height, version, background-color
[, quality, xiRedirectUrl, redirectUrl, detectKey]);
And get succeeded. You can also try this code and tell me what happens. I hope you will get success. All The Best.

I tried to use the same plugin of the link you posted.
I used following code and it worked fine in my IE too..
<html>
<head>
<script language="javascript" type="text/javascript" src="plugins.js" ></script>
<script language="javascript" type="text/javascript">
if (pluginlist.indexOf("Flash")== -1)
{
alert("You do not have flash player plugin installed.Please install flash player");
window.location = "/home";
}
else{
alert("You have it installed");
}
</script>
</head>
<body>
</body>
</html>
I think the problem seems with the way of writing tag.
Have you made it exactly like mine? Or you can go with my HTML.
Thanks!
Hussain

Related

Owl carousel does not work unless I refresh the page

Hello my problem with this library that does not load me on the first page, instead if I "refresh" if it loads, and the internet explorer does not work for me. someone has happened something similar. I don't know what I'm doing wrong, I put a link and a capture of the error. THANK YOU https://ccc.es/empresa/ https://ibb.co/3fXLPyH
<script type='text/javascript' src='https://ccc.es/wp-content/themes/norebro/assets/js/libs/owl.carousel.min.js?ver=5.4.2'></script>
I have found a possible solution from another colleague who passed by here I copy it, I don't know if this solution can be improved, but it works for me for now
`<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js"></script>
<!--DO NOT ENTER ANY EXTERNAL LINK IN BETWEEN-->
<script type="text/javascript">
$(document).ready(function() {
$('.owl-carousel').owlCarousel({
loop: true,
});
});
</script>`

Why does the jQuery source close before the rest of the code?

I am working through the book "Beginning Javascript". One of the examples in this book includes the following line:
<script type = "text/javascript" src = "jquery-1.11.3.js"></script>
Why would I open and then immediately close the jQuery source? Doesn't it need to stay open to run the jQuery code?
That is just including the jQuery library so you can use it. Your actual code would go in another script tag below it. Like this.
<div></div>
<script type="text/javascript" src="jquery-1.11.3.js"></script>
<script>
$('div').text('Hello World!');
</script>

javascript: HTML5 Audio Player

HTML5 Audio Player is not working on my mobile theme, but it works well on my desktop theme
javascript of my html5 player:
<script type="text/javascript">
$(document).ready(function(){
$("#JQAudioPlayer1").fdAudioPlayer({sourceURL:"/player_files/test6.xml",swfURL:"http://example.de/player_files/jplayer.swf",solution:"html,flash",mouseWheelEnabled:true,trackAutostart:false,trackRandom:true,trackRepeat:true,trackVolume:70,trackTitleScrollEnabled:true,trackTitleScrollDuration:5000,trackTitleScrollDelay:3000,trackTitleFormat:"_ALBUM_ - _TRACK_",timeShowHour:false,seekBarTipEnabled:true,playlistState:"expanded",playlistAnimationEasing:"easeOutQuad",playlistAnimationDuration:200,playlistButtonEnabled:true,playlistButtonString:"PLAYLIST",playlistVisibleRowCount:7,playlistAutoResize:false,thumbnailsScrollingStep:1,thumbnailsScrollingDuration:500,thumbnailsScrollingEasing:"easeOutQuad",thumbTipEnabled:false});
});
html code of the player on desktop theme:
<script type="text/javascript">
$(document).ready(function(){
$("#JQAudioPlayer1").fdAudioPlayer({sourceURL:"/wp-content/themes/audio/test6.xml",swfURL:"/player_files/jplayer.swf",solution:"html,flash",mouseWheelEnabled:true,trackAutostart:false,trackRandom:true,trackRepeat:true,trackVolume:70,trackTitleScrollEnabled:true,trackTitleScrollDuration:5000,trackTitleScrollDelay:3000,trackTitleFormat:"_ALBUM_ - _TRACK_",timeShowHour:false,seekBarTipEnabled:true,playlistState:"expanded",playlistAnimationEasing:"easeOutQuad",playlistAnimationDuration:200,playlistButtonEnabled:true,playlistButtonString:"PLAYLIST",playlistVisibleRowCount:7,playlistAutoResize:false,thumbnailsScrollingStep:1,thumbnailsScrollingDuration:500,thumbnailsScrollingEasing:"easeOutQuad",thumbTipEnabled:false});
});
html code of the player on mobile theme:
<script type="text/javascript">
$(document).ready(function(){
$("#JQAudioPlayer1").fdAudioPlayer({sourceURL:"http://www.example.de/wp-content/themes/audio/test6.xml",swfURL:"/player_files/jplayer.swf",solution:"html,flash",mouseWheelEnabled:true,trackAutostart:false,trackRandom:true,trackRepeat:true,trackVolume:70,trackTitleScrollEnabled:true,trackTitleScrollDuration:5000,trackTitleScrollDelay:3000,trackTitleFormat:"_ALBUM_ - _TRACK_",timeShowHour:false,seekBarTipEnabled:true,playlistState:"expanded",playlistAnimationEasing:"easeOutQuad",playlistAnimationDuration:200,playlistButtonEnabled:true,playlistButtonString:"PLAYLIST",playlistVisibleRowCount:7,playlistAutoResize:false,thumbnailsScrollingStep:1,thumbnailsScrollingDuration:500,thumbnailsScrollingEasing:"easeOutQuad",thumbTipEnabled:false});
});
Any help would be appreciated.
I'm sure you have noted sourceURL changes in each case.
This is why your player fails. He certainly cannot find files.
You should find where the sourceURL path is generated, and ensure it is the same for all.
Look:
/player_files/test6.xml ≠ /wp-content/themes/audio/test6.xml
{sourceURL:"**/player_files/test6.xml**",swfURL:"**http://example.de/player_files/jplayer.swf**",
{sourceURL:"**/wp-content/themes/audio/test6.xml**",swfURL:"**/player_files/jplayer.swf**",solution:"html,flash",
{sourceURL:"http://www.example.de/wp-content/themes/audio/test6.xml",swfURL:"/player_files/jplayer.swf",;

jQuery not loading in MAMP (1.11.2) when running website locally

Firstly I apologise for the fact that this question has been asked many times before, however none of the answers solved my problem so I thought that I would ask the question here.
I downloaded jQuery 1.11.2 (uncompressed) to locally develop my website however my code which worked using the jQuery built in to jsfiddle did not work locally. Therefore I added the following code to check if the jQuery had loaded:
<script src="file:///Applications/MAMP/htdocs/phpv1/v1/jquery-1.11.2.js">
if (typeof jQuery != 'undefined') {
alert("jQuery library is loaded!");
}else{
alert("jQuery library is not found!");
}
</script>
However I didn't get either alert box making me wonder if it was the Javascript which was not working, however I got Javascript to work using some simple form validation code. I am using MAMP to host the PHP and Google Chrome as the broswer. The file is saved as a HTML file and the code is as follows:
<html>
<style>
#test{
max-height: 150px;
max-width: 200px;
overflow: auto;
background: #50a8ff;
}
</style>
<head>
<script src="file:///Applications/MAMP/htdocs/phpv1/v1/jquery-1.11.2.js">
if (typeof jQuery != 'undefined') {
alert("jQuery library is loaded!");
}else{
alert("jQuery library is not found!");
}
</script>
</head>
<body>
</body>
</html>
I obviously can't use the Google hosted library as I am running the website locally. To determine the file path for the Javascript I opened it in Google Chrome.
You shouldn't put content inside a <script> tag that has a src attribute. Use two separate tags to test it:
<script src="file:///Applications/MAMP/htdocs/phpv1/v1/jquery-1.11.2.js"></script>
<script>
if (typeof jQuery != 'undefined') {
alert("jQuery library is loaded!");
}else{
alert("jQuery library is not found!");
}
</script>
You have two options here: either you use the jQuery hosted by Google
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
or then you would need to change to use relative path to file with something like this
<script src="jquery-1.11.2.js"></script>
when the jquery-1.11.2.js is on the same folder as your HTML page.
If you're running this from MAMP you need to change this line -
<script src="file:///Applications/MAMP/htdocs/phpv1/v1/jquery-1.11.2.js">
to this -
<script src="phpv1/v1/jquery-1.11.2.js" type="text/javascript">
if your HTML files are in 'htdocs'. I included type="text/javascript" in the event you're not using HTML5.

Redirect a urls domain but not it's ending (ending meaning /index.html)

I'll show you what i mean.
So let's say i had the url www.url1.com and I changed the domain to www.url2.com
but there are links to my website on a ton of other sites that still go to url1.com/post/12345678 and url1.com/post/91029323, etc. I still own both domains, but i need url1.com/post/1 and url1.com/post/9 to redirect to url*2*.com/post/1 and url*2*.com/post/9 instead.
Do you get what I'm saying?
Now these aren't really websites these are blogs hosted by tumblr but same difference.
I think I have the code figured out, but it just doesn't seem to work.
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script language="javascript" type="text/javascript">
function myFunction()
{
var permalink = document.URL;
var newlink = permalink.replace("url1","url2");
window.location.replace(newlink);
}
</script>
</head>
<body onload="myFunction()">
come ooon redirect already
</body>
</html>
For some reason it works in the previews while editing the blogs theme (its an iframe next to the html code(tumblr thing)), but not on the blog itself.
And if there is a way easier way to do it (please javascript jquery only (unless it's html or css (probably not css)) everything else never works for me) please tell me i'm oblivious sometimes
Thank's ahead of time.
use
window.location = newlink;

Categories