How to make a web page compatible with google chrome - html

I have include Html page into another html page in Dreamweaver using the below code
<script type="text/JavaScript">
$(function(){
$("#header").load("header.html"); });
</script>
but this code is not with Google chrome browser.
Please help me out how to make a web page compatible with Google chrome browser.

It seems that you open this page as local file. For security purpose Goodle Chrome doesnt allow to make AJAX call to local files. To solve this problem you can install the local webserver and open the page using http:// protocol instead of file://

Related

Linking to a Local Page from a Local Sever

I've previously explained that I was trying to link a ejs page to a jade-based app. Then after many failed attempts I tried to convert that page to Jade and still ended up with a truckload of errors. Finally, I thought about simply putting a HTML Link that would redirect me to that ejs page on click.
What I fail to understand though, is why Firefox has no problems displaying the page when I directly put its path in the browser:
file:///home/ghanem/Documents/Project/views/account/el/el.ejs
But when I try to access it from my app through a simple code, it doesn't redirect me to the same very page:
My Stubborn Link
I should also point out that I've already set security.fileuri.strict_origin_policy to false in Firefox.
What I fail to understand though, is why Firefox has no problems displaying the page when I directly put its path in the browser
Because it trusts you
But when I try to access it from my app through a simple code
Your app is "just another website" as far as Firefox is concerned. It doesn't trust it.
I should also point out that I've already set security.fileuri.strict_origin_policy to false in Firefox.
That lets XMLHttpRequest access file:// URLs providing the document it is running in was loaded from a file:// URL.
See mozillaZine: Links to local pages do not work.
user_pref("capability.policy.policynames", "localfilelinks");
user_pref("capability.policy.localfilelinks.sites", "http://localhost:7896");
user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");

Unable to enable Chrome app in iframe

I'm trying to load the native messaging example app in an external webpage as follows:
test.html
<html>
<head>
</head>
<body>
<iframe src="chrome-extension://knldjmfmopnpolahpmmgbagdohdnhkik/main.html"</iframe>
</body>
</html>
I have added the web_accessible_resources property in the app's manifest:
manifest.json
{
// <some code snipped>
"web_accessible_resources": ["main.html"]
}
However, when I use the app within test.html, I get the following error in the console, coming from a JavaScript file within the app:
Developer Console
Uncaught TypeError: Object # has no method 'connectNative'
main.js:51
The problematic line of code is the following:
main.js
port = chrome.runtime.connectNative(hostName);
Here's a screenshot - the problem happens when I click on the Connect button (which calls the connect function):
Obviously, this works when the app is run standalone. How can I go about loading the app in a webpage?
You can't. With very few exceptions, Chrome avoids proprietary extensions to the open web. You're asking for exactly that: an external web page that has nonstandard abilities simply because it's opened in Chrome rather than another browser. As the web is today, that kind of behavior would lead to a poor developer and user experience. The native-messaging documentation suggests that the functionality you want is available to Chrome extensions and Chrome apps. And as you're finding out, that's indeed the case: it works as an app, but not as a web-standard iframe. This is by design.
You probably want to write a Chrome extension. Your webpage should detect whether the Chrome extension is installed and whether the user's browser is Chrome. If it's not Chrome, it should give an appropriate error message. If it is Chrome but the extension is not installed, it should urge the user to install your extension.

Unable to load npapi helloworld plugin as extension in chrome browser

Downloaded the NPAPI hello-world plugin from https://github.com/axgle/npapi-chrome-plugin-helloworld and packaged it as a chrome extension (crx) using Chrome developer mode.
Loaded the above extension in chrome browser and tried to open test.html (provided with above plugin) in chrome browser. But it says "Could not load plugin"
Below is the source code of test.html
<doctype html>
<html>
<head>
<script>
window.onload = function(){
test = document.getElementById("pluginObj");
alert(test.sayHello());
}
</script>
</head>
<embed id="pluginObj" type="application/x-helloworld">
<body></body>
</html>
As per my validation, plugin is getting embedded (since on altering test it gives HTML document object) but unable to invoke sayHello method of the plugin.
However when I tried to load the above extension in another PC over there it loaded properly and was able to invoke sayHello method of the plugin.
Both systems have same OS (Windows XP + SP3) and both are using same version of chrome browser (23.0.1271.97 m)
Appreciate any help on this front.
When you added it to the CRX did you mark it public? If you don't it won't be visible outside of the extension.
See the relevant docs
Here is another relevant question: Google Chrome Extensions and NPAPI

Iframe inside PhoneGap App will not load a PHP page

I am creating an iPad app, using HTML5 and PhoneGap. I am wanting to put an iframe into a page and pull through some content in a php page found remotely on our server.
I have set the correct ExternalHost in the PhoneGap.plist file so that it will accept the external domain.
If I tell the iframe to access a .html page (on the server), it works perfectly - However if I change the extension to .php I get a blank iframe.
This is all while testing the app directly on the iPad and the IOS Simulator.
Could anyone suggest anything I have missed out?

Link to a network location using file:// does not work in Chrome

Our daily builds are stored in a shared network directory. My team wants me to put a link to that location on the results page - the most natural place would be among the artifacts. Clicking on that link should open the folder for viewing, copying, etc.
I've tried to implement the following solution: create an html file that redirects to the network directory and save it as an artifact. Here's the html file I generate (let's call it LinkToInstallation.html):
<html>
<head>
<script type='text/javascript'>
window.location='file:////file_server/dir_path'
</script>
</head>
<body>
</body>
</html>
Jenkins puts a link to this file among the artifacts. When I click on it from IE it redirects just fine, but from Chrome no redirection occurs, just an empty page is displayed. If I download the file (via Save Link As) and open it locally with Chrome - it works.
(1) Is there a workaround so that people do not have to change their Chrome settings?
(2) If not, how should Chrome be set up to redirect properly?
Chrome does not permit web pages to link to file:// URLs unless they were themselves loaded from file:// URLs. This is as a security precaution, as web pages running from file:// have permissions to read any file on your system. Similar restrictions apply for most other browsers.
Any reason you can't run an internal web server from your shared network directory? That'd solve the problem neatly.