Why does this Facebook page can't be displayed within a StageWebView? - facebook

By trying to open the website https://www.facebook.com/nike within a StageWebView, I received the following error:
ReferenceError: Can't find variable: console at
https://fbstatic-a.akamaihd.net/rsrc.php/v2/y2/r/KK4271o6DmT.js : 95
TypeError: Result of expression 'bigPipe' [undefined] is not an
object.
The website stopped loading and couldn't be displayed completly.
This is the Air/AS3 code I'm using:
var webView:StageWebView = new StageWebView();
webView.stage = this.stage;
webView.viewPort = new Rectangle( 0, 0, stage.stageWidth, stage.stageHeight);
webView.loadURL("https://www.facebook.com/nike")
How to get to load the website within StageWebView completely?
(Is there a way to ignore the errors?)
I'm using Flash CS6 and Adobe Air 3.9

I think this is a Embedded WebKit issue, you can Switch your webkit engine from Embedded to System browser engine. I tested using system browser its working fine, because it take our systems browser, you can switch your webkit engine by StageWebView( true ).
private var webView : StageWebView;
webView = new StageWebView( true );
webView.stage = this.stage;
webView.viewPort = new Rectangle( 0, 0, 1024, 768 );

Related

How do I open a game compiled for WebGL in Unity in Blazor?

I have created a Blazor Server project. In it, I wanted to put my WebGL game created in Unity3d on a separate page. In the end, after doing everything according to the example, I still can't get it to work. Although, I think, all things considered, but I see that the code markup index.html from WebGL game is different from other examples and there I haven't found a line of code:
unityInstance = UnityLoader.instantiate("unityContainer", "unity/WebGL/Build/WebGL.loader.js", { onProgress: UnityProgress });
I think I hooked it up right:
<script src="~/unity/WebGL/Build/WebGL.loader.js"></script>
#*<script src="~/unity/WebGL/Build/WebGL.framework.js.gz"></script>*#
<script src="~/unity/WebGL/run.js"></script>
I believe I wrote the mime type correctly:
var provider = new FileExtensionContentTypeProvider();
provider.Mappings.Remove(".data.gz");
provider.Mappings[".data.gz"] = "application/octet-stream";
provider.Mappings.Remove(".wasm.gz");
provider.Mappings[".wasm.gz"] = "application/wasm";
provider.Mappings.Remove(".js.gz");
provider.Mappings[".js.gz"] = "application/javascript";
provider.Mappings.Remove(".symbols.json.gz");
provider.Mappings[".symbols.json.gz"] = "application/octet-stream";
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "unity", "WebGL", "Build")),
RequestPath = "/Build",
ContentTypeProvider = provider
});
app.UseStaticFiles();
The error in the JavaScript console reads:
UnityLoader is not defined
If interested, here is my entire project:
https://github.com/EgorPavlovich/FPS.Servers.Test
I had to use the index.html file from the game build

Is it possible to get location from Messenger Webview

I'm trying to get user location inside a Facebook Messenger Chat-Extension.
I open the webview and ask as usual :
var options = {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0
};
function success(pos) {
var crd = pos.coords;
console.log('Your current position is:');
console.log(`Latitude : ${crd.latitude}`);
console.log(`Longitude: ${crd.longitude}`);
console.log(`More or less ${crd.accuracy} meters.`);
};
function error(err) {
console.warn(`ERROR(${err.code}): ${err.message}`);
};
navigator.geolocation.getCurrentPosition(success, error, options);
I'm getting this issue : ERROR(1): User denied Geolocation.Is there a way to get user location through Chat Extension Webview ? Thank you
geolocation should work fine on most iOS devices, but will fail on most (if not all) Android devices. That said there is no cross-platform solution for retrieving a user's geo location properly within a webview or Chat extension.

HTML audio playback causing flickering in iPhone

I'm trying to create a simple tuner built using Paper.js on top of a node.js stack.
The tuner works well in a desktop browser, but when in an iPhone or iPad, clicking on one of the six rectangles (or strings) causes an odd flickering of the screen:
http://morning-temple-9106.herokuapp.com/
I tried these css fixes that were related to general html flickering on the iphone, but no luck.
canvas {
-webkit-backface-visibility: hidden;
-webkit-transform: translate3d(0,0,0);
}
here is the JS that loads the audio -- I load the files before playNote is called for faster playback. the flicker occurs even if I load within playNote.
var audioPlayerE = new Audio();
audioPlayerE.src="strings/E.mp3"
audioPlayerE.load();
var audioPlayerA = new Audio();
audioPlayerA.src="strings/A.mp3"
audioPlayerA.load();
var audioPlayerD = new Audio();
audioPlayerD.src="strings/D.mp3";
audioPlayerD.load();
var audioPlayerG = new Audio();
audioPlayerG.src="strings/G.mp3";
audioPlayerG.load();
var audioPlayerB = new Audio();
audioPlayerB.src="strings/B.mp3";
audioPlayerB.load();
var audioPlayerElittle = new Audio();
audioPlayerElittle.src="strings/Elittle.mp3";
audioPlayerElittle.load();
playNote = function(index,count) {
var noteStr;
if(index-count==0) {audioPlayerE.play()}
if(index-count==1) {audioPlayerA.play()}
if(index-count==2) {audioPlayerD.play()}
if(index-count==3) {audioPlayerG.play()}
if(index-count==4) {audioPlayerB.play()}
if(index-count==5) {audioPlayerElittle.play()}
}
Here is my github repo:
https://github.com/dannycochran/cs184
from:
iPad Safari: How to disable the quick blinking effect when a link has been hit
didn't realize it was just a blinking effect, adding this to the css fixed it:
-webkit-tap-highlight-color: rgba(0,0,0,0);

How to show Camera Preview in metro app using javascript

i have StartPreviewAsync api to show camera preview on screen in C#
but not available in javascript ,so how can i get same preview(output) in javascript template??
or is any way to deploy xaml on javascript??
WinJS seems to have a different API for handling Camera Previews. I'd take a look at this example on MSDN for more details. Namely, in BasicCapture.js, we see the following function, startPreview:
function startPreview() {
displayStatus("Starting preview");
id("btnStartPreview" + scenarioId).disabled = true;
var video = id("previewVideo" + scenarioId);
video.src = URL.createObjectURL(mediaCaptureMgr, { oneTimeOnly: true });
video.play();
displayStatus("Preview started");
getCameraSettings();
// Initialize sliders.
for (var i = 0; i < cameraControlSliders.length; i++) {
cameraControlSliders[i].slider.disabled = false;
initSlider(cameraControlSliders[i]);
}
}
To answer your second question, the only way to load Javascript into a XAML application would be through the WebView control, and even that would not be allowed to directly control the different controls of the XAML UI. If you want to do XAML, you have to stick to C#, VB, or C++.

Writing to a new window

Im trying to get some simple javascript working in gwt but keep failing.
The code:
public static native void createWindow() /*-{
var wndRef = $wnd.open('','edit');
var divTag = document.createElement("div");
divTag.id = "div1";
divTag.setAttribute("align","center");
divTag.style.margin = "0px auto";
divTag.innerHTML = "blah blah blah";
wndRef.document.body.appendChild(divTag);
}-*/;
I am trying to open a new window and write content to it
The problem:
Currently this code opens a new window but its empty.
How do i write content to it ? am i doing something wrong or am i expecting too much from gwt?
Context: My end goal is to open a new Window and have my form panel and various widgets inserted in to it via java methods.
GWT is compiled to Javascript, so GWT can do what JS can do.
If you want to open a new window and inject some content to it then this is the right way:
var win = window.open("", "win", "width=300,height=200"); // a window object
win.document.open("text/html", "replace");
win.document.write("<HTML><HEAD><TITLE>New Document</TITLE></HEAD><BODY>Hello, world!</BODY></HTML>");
win.document.close();