w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to detect if a browser player can handle a video format
Thanks @Skymt. I couldn't find a method that returns playable formats. But this link might help you provide a better fallback (check under fallback options): https://developer.mozilla.org/en-US/docs/Web/HTML/Using_HTML5_audio_and_video#Showing_fallback_content_when_no_source_could_be_decoded I'm using videojs here is my javascript code: videojs("videoViewer", {playerFallbackOrder: ["html5", "flash", "links"]}, function(){}); var v = document.querySelector('video'); source = v.querySelector('source'); source.addEventListener('error', function(ev) { videojs("videoViewer", {playerFallbackOrder: ["flash", "html5", "links"]}, function(){}); }, false); It is very similar to the exemple you'll find on the link, the only difference is that I only have 1 source, and I am using

Categories : Javascript

Detect if browser / device can play HTML5 video inline before playing
I know this is an old question, but it's a big issue for me and there isn't a lot of information online. But I can answer your question after I found Alexey's answer in this thread: Detect if client allows inline media playback for HTML5 video. No, you can't detect if the browser/device supports inline video before playing it. That's the bad news. The problem is that the only reliable check for browsers like iOS Safari on iPhone is to start the video playing and then sniff if it instantly went to full screen native mode. Even that would fail if you made a player that automatically went to fullscreen on when the play event was triggered. The okay news, at least for me, is that by detecting it as soon as it starts playing along with using CSS media queries to detect screen size I should

Categories : Iphone

Right place to detect browser and show/hide a div
You could assign your condition to a scoped variable inside the controller: angular.module('myApp', []).controller('MyCtrl', ['$scope', function( $scope ) { $scope.isChrome = /chrome/i.test(navigator.userAgent); }); Then inside your view: <div data-ng-show="isChrome">You're running Chrome!</div> If you need a variable that's available to any controller, use a Service: angular.module('myApp', []).factory('UAService', function() { return { isChrome: /chrome/i.test(navigator.userAgent) }; }); Then from a page-level controller (i.e., one assigned to a top-level element such as <body>) or any other controller, inject your service: angular.module('myApp', []).controller('MyCtrl', ['$scope', 'UAService', function( $scope, UAService ) { $scope.

Categories : Javascript

How to show custom pop up when detect browser close event?
You cannot. Imagine an advertiser adding code to display a popup advert when the window is closed, or a trickster adding a popup which has "OK" and "Cancel" reversed or non-functional; it's back to the old days of the internet when browsers were too trusting and users were left occasionally needing to force-quit the browser just to escape a page. To prevent it, these days sites are allowed to display a block of text within a standard popup. You have no more control than that. The best proof I can offer is this: go to an online email provider and close the window while uploading something, or jsfiddle and close the window after editing something, or any major site where you can edit things without an autosave. Notice that they use the browser-standard popup. If there were an alternative,

Categories : Javascript

PHP detect browser support a tag
You can't check it using PHP, except you have a list with all supported tags for all different browsers. In this case you can compare the user agent and the tag against that list. You can use JavaScript on the client side to check for that very easily: try to create a new element of the given tag check the constructor for HTMLUnknownElement JavaScript if (document.createElement('bdi').constructor == HTMLUnknownElement) { console.log('This seems not to be supported by this or any other browser'); } You gotta do both things, as the element will always be created, no matter it exists or not. document.createElement('someRandomTagName') will never fail. Demo Try before buy

Categories : HTML

How to detect prefetching from the browser in PHP?
This question is very similar to "How to detect if cookies are enabled?". But you must use client-side redirection, because prefetched page start loading after loading main page. Directly prefetch request can by detected by header (X-Moz: prefetch for FF) or by passing additional param to a link. P.S. Without cookies enabled you cannot detect it for client, only for each directory prefetch request.

Categories : PHP

detect user being AFK from the browser
A easy solution would be to put onclick and onkeydown within the body Something like <body onclick='this.resetTime();' onkeydown='this.resetTime();'> code </body> Of course if you have other functions which need to do things on the click / keydown you can embed the reset time within them. this.resetTime() is also just a made up pseudo function, you'll have to make your own.

Categories : Javascript

How to detect country information through browser using ava
use MaxMind APIs to find which city IP is coming from based on that you can tell what language or date format you need to display here is the link for you. code example: LookupService cl = new LookupService(dbfile,LookupService.GEOIP_MEMORY_CACHE); System.out.println(cl.getCountry("151.38.39.114").getCode()); more detail

Categories : Java

Using navigator.platform to detect os in browser
Reliably checking the platform information isn't an easy problem. You can parse out navigator.userAgent, but I'd recommend using a library that can do this for you. Platform.js looks to be the most featured of these libraries.

Categories : Javascript

Detect webkit browser in javascript?
From this Post: How to detect chrome and safari browser (webkit) var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor); var isSafari = /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor); if (isChrome) alert("You are using Chrome!"); if (isSafari) alert("You are using Safari!"); Or more general webkit: var isWebkit = /webkit/.test( navigator.userAgent ); You should really be doing feature detection using something like Modernizr.

Categories : Javascript

how to detect a browser supports requestFullscreen
When you put if (docElm.requestFullscreen), you are detecting if the browser supports that method because it will return true if requestFullscreen is defined on the docElmobject.

Categories : Jquery

How to detect Android tablet browser?
visit here function isTouchDevice() { var el = document.createElement('div'); el.setAttribute('ongesturestart', 'return;'); return typeof el.ongesturestart === "function"; }

Categories : Javascript

How would you detect the current browser in an Api Controller?
You can use the HttpBrowserCapabilities in System.Web like this var userAgent = HttpContext.Current.Request.UserAgent; userBrowser = new HttpBrowserCapabilities { Capabilities = new Hashtable { { string.Empty, userAgent } } }; var factory = new BrowserCapabilitiesFactory(); factory.ConfigureBrowserCapabilities(new NameValueCollection(), userBrowser); //Set User browser Properties BrowserBrand = userBrowser.Browser; BrowserVersion = userBrowser.Version; This relies on browscap.ini in Windows/System32/inetsrv/ or Windows/SysWOW64/inetsrv for definitions. You can get more up to date definitions for free from here http://tempdownloads.browserscap.com/ This article may also help - http://stephenwalther.com/archive/2010/03/05/use-asp-n

Categories : C#

detect request from mobile app not from browser in php
I assume that you're using an NSURLRequest somewhere... Create a mutable request NSMutableURLRequest and set the header you want to check for in the PHP (using addValue:forHTTPHeaderField:).

Categories : Iphone

Uploading a video to youtube from browser
Is there a reason you can't just use the YouTube upload widget? https://developers.google.com/youtube/youtube_upload_widget Anyways, straight from the API reference https://developers.google.com/youtube/v3/docs/videos/insert badRequest mediaBodyRequired The request does not include the video content. Another resource: https://developers.google.com/api-client-library/javascript/samples/samples

Categories : Javascript

How to detect if browser address bar is showing on iOS devices?
You should take a look at the window.innerHeight property. That is the height of the content on screen. The value of that decrease a lot when the address bar is visible. You may need to test out the decrease in height on different device to make that work better

Categories : Javascript

PHP: Detect less than IE9 and ignore document and browser mode
You could just disable compatibility mode: header("X-UA-Compatible: IE=edge"); Or in the HTML source: <meta http-equiv="X-UA-Compatible" content="IE=edge" />

Categories : PHP

Detect Blackberry Browser on google Sites
I don't know exactly which BlackBerry devices you're trying to detect. Unfortunately, the answer is different for many of them. From this BlackBerry.com reference document, some UserAgent examples: User Agent in BlackBerry 10 Mozilla/5.0 (BB10; <Device Type>) AppleWebKit/537.10+ (KHTML, like Gecko) Version/<BB Version #> Mobile Safari/537.10+ User Agent in BlackBerry Tablet OS Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.0.0; en-US) AppleWebKit/535.8+ (KHTML, like Gecko) Version/7.2.0.0 Safari/535.8+ User Agent in BlackBerry 6 and BlackBerry 7 Mozilla/5.0 (BlackBerry; U; BlackBerry AAAA; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/X.X.X.X Mobile Safari/534.11+ User Agent in BlackBerry Device Software 4.2 to 5.0 BlackBerry9000/5.0.0.93 Profile

Categories : Javascript

Detect if extension is enabled on Chrome browser
You have a few options. Make an extension of your own that declares the management permission and then reports the results of get or [getAll][1] to your plugin, then examines ExtensionInfo for the enabled/disabled state. Change the extension you're interested in to alter the page's DOM in some way that the plugin can detect. E.g., add an invisible div with ID "yes-the-plugin-is-installed." If you don't have control over the extension and don't want to write your own extension, then figure out how the extension changes the behavior or structure of the page, and write code in your plugin to detect it. This method is fragile, of course, but it doesn't rely on any extension code whatsoever to work. If you're looking for a general answer of how an arbitrary web page can detect an arbitrary

Categories : Jquery

php html output video with no extension to browser
<?php // tell the browser the file type header("Content-type: video/mp4"); // tell the browser the file size header(sprint("Content-size: %d", filesize($pathTmp4))); // disable output buffering before delivering the file while(ob_get_level()) ob_end_clean(); // send it over readfile($pathTmp4); // done, track speed and such optional stuff here ?> Consider readfile. Will output directly bypassing the load in memory that file_get_contents does. Or just open the file and use fread to send chunks. NEVER load the entire thing in memory before sending it. UPDATE In terms of speed, you need to test. This will bypass .htaccess issues as it uses PHP to spit out the file. This allows you to control headers and feed the appropriate types to the browser. Downside is the PHP overhead for jus

Categories : PHP

Autoplay video element on mobile browser
No, there is no way on iOS/Safari (or iBooks). Videos load only in the context of an event handler reacting to user action such as a touch. You're out of luck. This has been documented extensively in any number of questions right here on SO, and is clearly documented by Apple.

Categories : Javascript

How to play video on an ios captive portal pop up browser
It works in ios 7. It seems that ios 6 (or below) cannot load some resource types (such as mp4 or zip and so on) in the popup web browser. Here mention a method to how to solve these kind of problems.(it skips the popup browser) But if you really want to play videos in the popup browser, I'm also researching it...:P

Categories : IOS

embed mp4 video in browser using .net ashx and querystring
Wow, where to beging... You need to think of yourself and your code merely as a plate on which you are serving a video file to be played in a player. The most important question here is: What really is the format of your MP4 video? The ContentType or the file extension do not tell us anything about the encoding. It could very well be that your user base may not be able to play your particular video clips. So... what is happening? What is popping up, is it throwing errors?

Categories : C#

Tablet detection with detect mobile browser script?
To answer the first part of your question: You add it right before the first "/i". The current PHP version of the script would become: <?php $useragent=$_SERVER['HTTP_USER_AGENT']; if(preg_match('/(android|bbd+|meego).+mobile|avantgo|bada/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)/|plucker|pocket|psp|series(4|6)0|symbian|treo|up.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55/|capi|cc

Categories : PHP

Detect browser support for HTML Media Capture
This form of media capture in browsers is outdated, deprecated, and obsolete. The new standard, getUserMedia, can be detected like so: function hasGetUserMedia() { return !!(navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia); }

Categories : HTML

how to detect event when user has disabled javascript in his browser?
You can't. JavaScript is required to detect events. Follow the principles of Progressive Enhancement and Unobtrusive JavaScript instead.

Categories : Javascript

jquery detect when user uses browser auto correct
One Line!! I simply wired the update event to document.getElementById("CharterName").oninput = update; and my text updated when the browser updated the input.

Categories : Jquery

stream audio/video files from gridFS on the browser
The PHP GridFS support has a MongoGridFSFile::getResource() function that allows you to get the stream as a resource - which doesn't load the whole file in memory. Combined with fread/echo or stream_copy_to_stream you can prevent the whole file from being loaded in memory. With stream_copy_to_stream, you can simply copy the GridFSFile stream's resource to the STDOUT stream: <?php $m = new MongoClient; $images = $m->my_db->getGridFS('images'); $image = $images->findOne('mongo.png'); header('Content-type: image/png;'); $stream = $image->getResource(); stream_copy_to_stream( $stream, STDOUT ); ?> Alternatively, you can use fseek() on the returned $stream resource to only send back parts of the stream to the client. Combined with HTTP Range requests, you can do this pre

Categories : PHP

HTML5: capture audio AND video combined from web browser
hi trying to do the same may be you should look at [http://jsfiddle.net/james2doyle/URyLt/] let me know if you mange to do thanks $("button").click(do_it); function do_it() { var obj = {}, txt=""; if (this.id == "video") { obj = { video: true, audio: true }; txt = "<video>"; } else { obj = { video: false, audio: true }; txt = "<audio>"; } navigator.webkitGetUserMedia(obj, function(stream) { $("#result").empty(); var output = $(txt).appendTo("#result")[0], source = window.webkitURL.createObjectURL(stream); output.autoplay = true; output.src = source; console.log(stream); window.a = stream; //debug

Categories : HTML

Restrict browser refresh, f5, browser back like banking sites through javascript/jquery
(1) No. There no possible cross-browser way to control browser functionality with javascript/jquery. (2) Banking sites do not restrict or control the browser functionality. They only ask users to desist. At most they attempt to detect some actions and then show errors. But, they don't try to control the browser. (3) This is a bad idea.

Categories : Javascript

Browser requests file, server downloads pdf, browser displays pdf in iframe
Probably what you meant was simply: var uri = '/viewer/loaddrawing/'; document.getElementById('iframetitle').src = uri + '?key=' + value; There is no JSON involved, so the iframe will get a PDF directly. However, notice that the client must have a PDF-viewer plugin, otherwise the browser will ask for a download prompt.

Categories : Javascript

BlackBerry 10 browser submits form using browser submit button when using preventDefault
I have worked around this by adding action="javascript:void(0);" to you form (see updated fiddle http://jsfiddle.net/e4AHZ/11/). I do not know if this is good enough but action="javascript:void(0);" is in fact part of a solution given to a similar question. <form method="post" action="javascript:void(0);"> <input type="text" name="field1" value="some msg" /> <input type="text" name="field2" value="some msg" /> <input type="submit" /> </form>

Categories : Javascript

How to open links in default browser inside InApp Browser on PhoneGap
I have been using this as a workaround (opening an inappbrowser instance): // Image zoom $('#container').on('tap', '#content.cmscontent img', function() { var browser = window.open((navigator.userAgent.indexOf('Android') != -1 ? 'file:///android_asset/www/' : '') + encodeURI($(this).attr('src')), '_blank', 'location=no,toolbar=yes,enableViewportScale=yes,transitionstyle=crossdissolve'); }); See I added (navigator.userAgent.indexOf('Android') != -1 ? 'file:///android_asset/www/' : '') as a prefix before the url. Now it detects when you're app is on Android and adds the local URL in front of it.

Categories : Android

Image looks terrible when viewed on a mobile browser, but perfectly fine on a web browser
You'll have to use a responsive layout to resize the image according to the screen size. Example of responsive layout rule: @media screen and (max-device-width: 480px) { .column { float: none; } } You can always search "responsive design" at any web search engine to get great references.

Categories : HTML

Detect if browser supports WebP format? (server side)
The "proper" way is to check the accept header which is sent, but a bug in Chrome means that it won't list image/webp even though it does support it. This is a relevant forum thread: https://groups.google.com/a/webmproject.org/forum/#!topic/webp-discuss/6nYUpcSAORs which links to this bugtracker: https://code.google.com/p/chromium/issues/detail?id=169182 which in turn links to this one: https://code.google.com/p/chromium/issues/detail?id=267212 End result? While it isn't implemented just yet, soon Google Chrome will explicitly list image/webp as an accepted type for both image and non-image requests. So your script which serves the HTML can check for that. Opera already sends image/webp as part of its standard accept header (again regardless of whether it is an image request or not). S

Categories : PHP

How to Detect collision of Cube Mesh with browser boundary in ThreeJS
Three.js uses a 3D spatial coordinate system where the X and Z axes are horizontal and the Y axis is vertical. The origin (0, 0, 0) is just an arbitrary point in that space, and you can "look around" in the 3D world so the origin might not be on the screen. The coordinates of an object in Three.js-space are also, for all intents and purposes, arbitrary units. You can convert between the 2D screen space and the 3D world space using projectors. Going from 3D to 2D has already been answered, and there is also a nice tutorial on the topic. So, to find out whether a mesh is on the screen, you should project its 3D position to 2D screen space and then check whether that is outside the size of the window or canvas.

Categories : Javascript

Problems while previewing image before upload on mobile browser, works fine on desktop browser
Modified another code snippet for it to work properly on browser. The code snippet, I modified is mentioned at the link below. Preview an image before it is uploaded Below is the code snippet which work properly on both desktop browser as well as mobile browser. <!DOCTYPE html> <html> <head> <title>File API- FileReader as Data URL</title> </head> <body> <input type='file' id="imgInp" /> <img id="myImage" src="#" alt="your image" /> </body> <script> function readURL(input) { if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function (e) { document.getElementById('myImage').src=e.target.result; } reader.readAsDataURL(inpu

Categories : Javascript

How to force to open a web page in external browser even if Popup Browser is enabled in Samsung Galaxy Note II
I don't understand your problem clearly but may this help you: Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse((String) i.getExtras().get("url"))); startActivity(browserIntent); where "url" is the URL to which you want to go in your browser. And i is an INTENT that holds the "url" from another activity. Can this help you?

Categories : Android

Asp.Net: Retaining the old browser session after closing and reopening browser instance
You cannot reclaim the session-id as such, but you can certainly restore some of the predictable part of the session state. If you are using forms authentication, then just read the forms-auth cookie in global.asax session start and re-populate the session objects. You can control the expiration of forms-authentication cookie manually by creating a persistent cookie by using: FormsAuthentication.SetAuthCookie(userName, true) Alternatively, you can fine-tune the expiration by manually changing the cookie: Dim authCookie As HttpCookie = FormsAuthentication.GetAuthCookie(userName) Dim authTicket As FormsAuthenticationTicket = FormsAuthentication.Decrypt(authCookie.Value) Dim newAuthTicket As New FormsAuthenticationTicket(authTicket.Version, authTicket.Name, authTicket.IssueDate, expireDa

Categories : Asp Net

Need some plugin to use in selenium for browser compatable( for cross browser UI testing )
Selenium is a browser automation tool. It can only drive the browser by interacting with an HTML page loaded in the browser. There are currently no plugins (and as far as I'm aware nobody has any plans to make any) that you can add to Selenium to enable it to automate the OS level GUI.

Categories : Testing



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.