Hi I've got follow json:
let help = {
url: 'file://myServer/folder1/myFile.pdf'
};
With this function I try to open the file in a browser:
openPdf() {
window.open(help.url);
}
This is my html:
<button ng-click="ctrl.openPdf()">Open PDF</button>
Now, when I click on the button, a new tab opens in the browser without the pdf file. There isn't also my url from the json. It opens a empty page - about:blank. But when I copy the url from the json and paste it again in the browser, it opens the file correctly. But this also works only, when I put file:// before the url (without this, or with http:// etc. it also doesn't work) - Browser = Google Chrome. The confusing thing is: It works on Internet Explorer! When I open the url (with file://), than it shows me the pdf in a new browser tab. Is there perhaps a pdf plugin for browser, that isn't installed on chrome? Any ideas what could be wrong here? Thanks
Related
I'm trying to use window.open to open an extension page, I don't care about checking if the user has the extension, I just want to open a window that starts with extension://, it's not working and says failed to load url because the scheme does not have a registered handler. My code looks like this:
const openedWindow = window.open("extension://<extension url>", "", "width=300, height=300");
openedWindow.onload = () => {
openedWindow.close();
}
this code works with normal urls, but not with ones starting with extension://. Is there any way to open a url like this?
edit: needed to use chrome-extension:// instead of just extension. Now there's a new problem, chrome is blocking the page. How do I fix this?
It's because the correct URL for a chrome extension is chrome-extension://1234
Also popups should be explicitly allowed by a user interaction on the popup permission that Chrome asks in the URL bar
i´m currently using JavaScript and HTML with eel and Python. But unfortunately when I am trying to create a file in the Chrome-Browser window (as an download) over JS i can only download it once.
The second "download" is not working.
-> Chrome just shows this (as it does when it downloads something) but then nothing happens:
When I am using Edge browser or only JS without eel it works perfectly fine!
My JS function that creates the download: (string is a json string that is generated earlier).
var jsonLink = document.getElementById("jsonLink");
jsonLink.download = "exportedToJson.json";
jsonLink.href = "data:application/json;charset=utf-8," + encodeURIComponent(string);
Ok I found a solution:
My chrome browser was blocking more than one download from "localhost:8000". So I had to go to settings and allow more than one download.
Maybe this helps someone :)
Why did I not find this earlier:
When I started my Python script, it calls:
eel.start('index.html', mode='chrome', port=8000) #starting chrome
Which does open a new Chrome Tab without the Tabbar (so i did neither see the tabs nor my favorite sites). Therefore I did not get a notification when chrome stated that download is blocked.
But after starting the eel-local webserver and open localhost:8000 in my normal chrome window, I did get a notification and I was able to allow the downloads.
-> afterwards it also worked in this eel-chrome window.
I don't know much about JavaScript. I am trying to open a tab with a file URL and it keeps reverting to the about:newtab page. Is it possible to open a file URL in Firefox extension?
Currently I am using:
var updating = browser.tabs.update(tab.id, { url: result.data.url });
updating.then(onUpdated, onError);
Where result.data.url is a file URL. It works with HTTP and HTTPS URL.
I am using Firefox 56.0.1
Currently it's not possible. You can follow bug https://bugzilla.mozilla.org/show_bug.cgi?id=1266960 to stay up to date.
I am having some trouble downloading vcard on iphone chrome.
I making an API call from the href which returns a .vcf file to download the vcard, it is working fine on desktop (IE/Chorme/Firefox..) and working fine on iphone safari and samsung chrome,
but when i tried to download on a chrom iphone it is throwing an exception as shown in the image
Using
API bound to href is something like GET: http://.../rest/v1/profiles/00d5a2fb-ab56-a555-a5d5-0050569257ef/vcard
code to return the vcards .vcf file is something like
var vCard = BuildVCard(profile, profileUrl);
vCard returns a Vcard
return new FileActionResult(
new StringContent(vCard.ToString()),
"text/vcard",
CreateVCardFileName(profile));
and CreateVCardFileName returns a string.Format("{0}.vcf", fileName);
the entities on fiddler headers shows something like
Content-Disposition: attachment; filename=Uma.vcf
Content-Type: text/vcard
Is this something related to IOS- Chrome thing, do I need to add anything to download the vcard like any specific mime-types.
Appreciate your help and time.
I tried using this on a site. Routing to a "Please open in safari" page did work. Getting the .vcf file to download on chrome mobile by linking to the .vcf file like in the demo did not, it only brought me to a blank external page or gave me a fail like yours above.
When I put the exact live demo on my server the download to ANY phone button still did not work as the original live demo. It is my opinion that the different PHP versions the sites a running on are causing this but I could be very wrong.
How to add a contact to the iPhone's Address Book from a Web Page?
I am trying to save the HTML from a webpage into a file so if my app is opened and no internet is available then the webview loads from a file instead. Here is my debugging code - the first time the view is created it downloads the file. The second time onwards it opens the files
WebView cwebView = (WebView) rootView.findViewById(R.id.aboutWebview);
if(loadedLatest) {
cwebView.loadData(FileUtils.read(Values.aboutWebviewOfflineFile,getContext()),"text/html", "UTF-8");
cwebView.getSettings().setJavaScriptEnabled(true);
//cwebView.getSettings().setBuiltInZoomControls(true);
}else {
cwebView.loadUrl(Values.aboutPageURL);
new GetWebviewContents(getContext()).execute(Values.aboutPageURL, Values.aboutWebviewOfflineFile) //Saves the HTML to a file;
loadedLatest = true;
}
The HTML download and file seem to be working correctly however the webview looks completely different when from online and when from the file - it is much narrower and images overlap. I have tried using .loadurl(File...) and it has the same effect. Enabling Javascript makes no difference.
Does anyone have any idea what could be causing this?
Thanks
I don't know for sure, but it could be the issue of Cross-Origin blocking by the WebView. To verify that this is the issue, open the same webpage that you saved on your app, on your laptop or desktop, and save it on your disk. Then try to open that saved page and see the Javascript console on your's browser Developer Tools and see if it shows any Cross-Origin access restriction errors.