Local swf files not working in Google Chrome - google-chrome

When i open an swf file, Google Chrome downloads it, when it's already downloaded.
And then says "this kind of file can harm your computer", and it just wont play it.

I'm a sysadmin and today a user brought this to my attention. It seems that Chrome no longer supports the direct opening of these file types. Make sure you have the relevant adobe flash version installed and then use IE11 or Firefox. For more info see here: https://bugs.chromium.org/p/chromium/issues/detail?id=767342
Mike

Imbed the swf files in HTML and then load the html page. Note that you wont be able to directly access the HTML page, put the html folder structure in local tomcat and then access the content and obviously enable the flash player on chrome.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div id="CaptivateContent">
</div>
<script type="text/javascript">
var so = new SWFObject("viewer.swf", "Captivate", "1025", "810", "10", "#CCCCCC"); //change the swf file name
so.addParam("quality", "high");
so.addParam("name", "Captivate");
so.addParam("id", "Captivate");
so.addParam("wmode", "window");
so.addParam("bgcolor","#f5f4f1");
so.addParam("menu", "false");
so.addParam("AllowScriptAccess","always");
so.addVariable("variable1", "value1");
so.setAttribute("redirectUrl", "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash");
so.write("CaptivateContent");
</script>
<script type="text/javascript">
document.getElementById('Captivate').focus();
document.Captivate.focus();
</script>
</body>
</html>

Related

How to create a download link when opening a file from local file system

We are shipping some docu stuff on a cd and to have a better overview over all the files, we want to provide an index of all files as html, that can be put on the cd. The idea is that the user can download the wanted files just like from any webpage.
The problem is, that I can open the pdf in the browser but i want the download dialog to pop up if i click the button so I added the download="some-name.pdf".
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Demo</title>
<base href=".">
</head>
<body>
Download file
</body>
</html>
Using this via webserver (http) seems to work, but I cannot get it to work from the local file system...
To reproduce, just store the snipped in a file, create a folder "files" next to it and put any pdf file with an .html extension and name it test.pdf. Then open the page in a browser like Chrome or FireFox. (I am on a mac, but i guess it is the same for Windows or Linux?!)
Any help would be appreciated.

Google VR View Error - Unable to load texture from ffff.jpg

This is my index.html file
<html>
<head>
<title>VR Sample</title>
<script src="//storage.googleapis.com/vrview/2.0/build/vrview.min.js"></script>
</head>
<body>
<div id="vrview">
<iframe width="100%"
height="300px"
allowfullscreen
frameborder="0"
src="http://storage.googleapis.com/vrview/index.html?image=ffff.jpg&is_stereo=true">
</iframe>
</div>
</body>
</html>
And this is the structure of the website folder
I tried hosting it in Webserver for chrome as per the instructions in the google codelabs. But I clicked the 127.0.0.1.8887 url, I got a blank page with no files or folders. Then I tried hosting it on XAMPP and It did work. However, I did not get the panaroma image. Instead I got this error
I took the 360 image with google camera app and converted it to stereo with the google's online converter but got the same error. I also tried downloading the VRView repo from github and modified the code as
src="vrview/index.html?image=ffff.jpg&is_stereo=true"
that too didn't work.
You are using the iframe version of vrview meaning when you request "ffff.jpg", you are actually requesting:
http://storage.googleapis.com/ffff.jpg
Try using the javascript version
Try this:
<html>
<head>
<script src="http://storage.googleapis.com/vrview/2.0/build/vrview.min.js"></script>
<script>
window.addEventListener('load', onVrViewLoad);
function onVrViewLoad() {
var vrView = new VRView.Player('#vrview', {
image: 'http://storage.googleapis.com/vrview/examples/coral.jpg',
is_stereo: true,
width: '100%',
height: 300
});
}
</script>
</head>
<body>
<div id="vrview"></div>
</body>
</html>
Note: chrome cannot access files off a harddrive.
EDIT: This is due to CORS.
Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served.
Thanks to #Eleanor Zimmermann for noting this.

Not able to load javascript files in webbrowser in windows phone 8

In one of my Windows Phone application I am using webbrowser to display the html content. I am getting the html content by making post request to server. Here I am getting the response correctly.Then I am displaying this response in webbrowser by,
webBrowser.IsScriptEnabled = true;
webBrowser.NavigateToString(responseString);
The response is:
<html>
<HEAD>
<script language='JavaScript'>
</script>
<SCRIPT language='JavaScript' src='script/page.js'></SCRIPT>
<script type="text/javascript" charset="UTF-8" src="js/page2.js"></script>
</HEAD>
<BODY onload='someFunction()'>
<div>
--
<img src='Images/loader.gif' /><br /><br />
--
</div>
</BODY>
</HTML>
From here I am not able to call the page.js file, page2.js file and not able get the loader.gif image also. I think this is because the files are not locally stored.
I also tried by saving the response in Isolatedstorage as .html file. and displaying it
by using,
webBrowser.IsScriptEnabled = true;
webBrowser.Navigate(uri);
but here also I am getting same thing.
Please help me to get resolve this issue. Thanks in adcvance
The scripts and images aren't loaded, because paths to it in the html are relative. When you save it to a file, the scripts and image should be in relative locations to that file.
You should use webBrowser.Navigate with the Uri of the web page on the net (don't download it yourself, let the browser do it). Or the html has to have the full paths, like: <img src='http://contoso.com/Images/loader.gif' />.

Direct downloading link in browser opening file instead of downloading it

I am trying to create a html simple website on IIS that will help downloading files.
<!doctype html>
<html lang="en">
<head>
</head>
<body>
Start automatic download!
</body>
</html>
This is running file. On clicking "Start automatic download!" it is downloading newUpdater.xml in browser. But, If I directly give this download link in browser (below), it is opening the XML file in all browsers(chrome, firefox).
http://169.254.68.202/newUpdater.xml
Any Idea How to fix this. I think this is possible as
http://dl.google.com//googletalk//googletalk-setup.exe
this link on browser will start downloading gtlk directly.

Javascript disabled in MS Access WebBrowser Control when viewing local file

I have seen similar posts before, but none of the solutions I have seen online seem to work for me.
I am trying to use a WebBrowser Control to display a locally saved HTML file that uses the Google Maps JavaScript API, but JavaScript remains stubbornly disabled.
To test the problem, I made a simple page using Google Maps based on https://developers.google.com/maps/documentation/javascript/examples/map-simple . I also added a button to directly test if JavaScript was functioning
c:\map-test.html works perfectly in both Firefox and IE.
<!DOCTYPE html>
<html>
<head>
<title>Google Maps JavaScript API v3 Example: Map Simple</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html, body, #map_canvas {
margin: 0;
padding: 0;
height: 100%;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script>
var map;
function initialize() {
var mapOptions = {
zoom: 8,
center: new google.maps.LatLng(-34.397, 150.644),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map_canvas'),
mapOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<input type="button" onclick="alert('JavaScript Functioning');" value="Test JavaScript">
<div id="map_canvas"></div>
</body>
</html>
I then created an MS Access form with a WebBrowser Control named cWebBrowser and added a method to load c:\map-test.html. The Google Maps interface doesn't load and the test button is dead.
Private Sub Form_Current()
Me.cWebBrowser.ControlSource = "=(""file:///C:/map-test.html"")"
End Sub
Next, I tried the online version of map-simple. The JavaScript worked as expected and the Google Map interface loaded
Private Sub Form_Current()
Me.cWebBrowser.ControlSource = "=(""https://google-developers.appspot.com/maps/documentation/javascript/examples/map-simple"")"
End Sub
I have been trying to solve this problem for quite a while without success.
Following this article, http://support.microsoft.com/?kbid=315933 , I enabled the My Computer Zone in IE security settings
In all zones I enabled the following:
Allow scripting of Microsoft web browser control
Active Scripting
Under the Advanced Tab I enabled the following:
Allow active content from CDs to run on My Computer
Allow active content to run in files on My Computer
Someone suggested adding Mark of the Web to my pages, but that didn't help either.
I have tried clearing the cache.
I have tried changing the filename, in case the cache remained after clearing.
map-test.html works when downloaded in both IE and the WebBrowser Control but only works locally using IE. What else could be causing the problem other than a security setting? Is there a security setting that I am missing? Is there any other test that I could do to diagnose the problem?
I'm at my wits end.
Environment:
Windows 7 64bit
Access 2010
IE 9
P.S.
The problem continues to get weirder
Today, I tried creating an extremely simple JavaScript page to ensure it wasn't the Google Maps code causing the problem.
<!DOCTYPE html>
<html>
<body>
<input type="button" onclick="alert('JavaScript Functioning');" value="Test JavaScript">
</body>
</html>
It worked at first and I was elated. Next, I tried the Google Maps test page and that worked too! So, I tried my full-featured map (working in IE and Firefox) that loads JSON output from my DB application and it all went down in flames, Google Maps code internally caused numerous errors (unfortunately, I didn't document the errors).
Now, I'm back at square one; none of the pages allow scripting, including the 5 liner above ?!?!
First, have a look at Enhanced Protected Mode and Local Files and Understanding Local Machine Zone Lockdown.
What works on my machine
I've tested different configurations, using your exact same environment, and they all work (see caveats below).
Created a new form, add a webbrowser control to it then:
Set its ControlSource to the URL works:
Download the HTML and save it to my desktop, then reference the local file in the ControlSource works:
Added a button and set the Webbrowser's ControlSource within its OnClick event works:
Private Sub Command1_Click()
WebBrowser0.ControlSource = "=""C:\Users\Renaud\Desktop\map-simple.htm"""
End Sub
Solutions
From the links to the articles about local webpage security I mentioned above, I tried a few things:
If the file in saved in the user's temp folder, it will load properly.
Try it, type %TEMP% in Explorer and it should take you to C:\Users\username\AppData\Local\Temp or something equivalent.
Save the html file there and try to load it from Access, for instance using the button on the form above:
Private Sub Command1_Click()
WebBrowser0.ControlSource = "=""C:\Users\Renaud\AppData\Local\Temp\map-simple.htm"""
End Sub
Alternatively, for IE to allow you to open the file, you would need to lower its integrity level so it is forced to run in the Internet zone when IE opens it (and thus make it work properly).
You can check the current settings for the file by opening the command prompt (as Administrator):
Now, we can set the file Integrity and check the settings again:
Now you should be able to open the file from Access and IE.
Note though that the ACLs travel with the file when you move them from NTFS system to another NTFS system, but they could be lost if you copy them to a USB flashdrive or another system formatted as FAT for instance, so they may need to be re-applied on the target machine if they are lost.
I tried to add a Mark Of The Web to the file itself, as Remou mentioned, but it doesn't work for me, the file won't load.
Here is what I tried:
<!doctype html>
<!-- saved from url=(0014)about:internet -->
<html>
<head>
<title>Google Maps JavaScript API v3 Example: Map Simple</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
....
One other thing that should work is to try to serve the files from a local http server, like Mongoose
What works on my machine
Purely for the sake of future readers.
Using Windows 7 and Access 2010 and the Webbrowser Control from the toolbar, not from the additional ActiveX controls; using the code (below) from the OP and adding Mark of the Web (MOTW); using a *.html document saved to desktop; setting webbrowser control source to ="C:\Users\<user>\Desktop\java.htm".
<!DOCTYPE html>
<!-- saved from url=(0023)http://www.contoso.com/ -->
<html>
<head>
<title>Google Maps JavaScript API v3 Example: Map Simple</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html, body, #map_canvas {
margin: 0;
padding: 0;
height: 100%;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script>
var map;
function initialize() {
var mapOptions = {
zoom: 8,
center: new google.maps.LatLng(-34.397, 150.644),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map_canvas'),
mapOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<input type="button" onclick="alert('JavaScript Functioning');" value="Test JavaScript">
<div id="map_canvas"></div>
</body>
</html>
I've used the WebBrowser Control many times on Access forms, with locally-generated content.
For portability, I don't want to mess with the security settings on each computer.
My solution is to use VBA instead of Javascript, for anything run locally. You can even attach VBA-based event handlers to document elements. (Use Object Browser to explore the MSHTML library.)
This includes both files loaded with file:// and on pages built by navigating to about:blank and then writing content with WebBrowser.Document.Open / .Write.
For Google Maps, you should be able to build a local document that hosts an Internet-based iframe.
Security-wise, Javascript won't work in the local document but it should work in the iframe.
...Tom Robinson