How to open a pdf on same page using pdf.js - html

I want to open up a pdf page on a web page on click of an icon and I want that page to be opened on the same page. I tried to use - pdf.js, but I am facing problem in running helloworld of pdf.js. So how do I use odf.js locally?
Link referred: https://github.com/mozilla/pdf.js/tree/master/examples/helloworld
Thanks

Probably not the issue you are experiencing but you will want to turn off web workers if you're using PDF.JS in multiple instances on the same page.
PDFJS.disableWorker = true;

it does not work with file://, you need to upload the files to your webserver, because AJAX just works with a webserver and not on the clientside

Related

Downloading Angular or ReactJS web pages

I need to write a parser which will collect data from a website which was developed using ReactJS. The problem is when open source code (Ctrl+U) I don't see anything in the code but if I inspect an element a can see full webpage in for instance google inspector (Ctrl+Shift+I)
Do you how can can download html code from the inspector?
I can not speak for React, but with angular if you locally host the site (ng serve) you will not be able to ctrl+u. However, if it's hosted somewhere you can ie: https://angular.io/

is it possible to open the plugin extension window with a url?

I am trying to build a chrome extension. Now, My usecase is that, Clicking on the plugin icon should hit a url hosted at a server, and the response for the url should be rendered in the plugin window. Is it possible ?
A simple <iframe> inside your HTML will serve your purpose, unless you run into a page that actively prevents framing; then I don't think this is directly possible.

Webpage doesn't update after changing files via FTP

I have a website with a domain and host. I sometimes change some pages and upload them via FTP (I'm using FileZilla). Tough, when I enter the webpage from the domain, the latest changes doesn't appear. I have checked many times the html files I've changed and they all look correctly uploaded to the host. But when I save the html page and check its code, the changes doesn't appear as expected. Why are the changes aren't being updated when browsing the webpage and how can I solve this?
Try refreshing the page using CTRL+F5, if it's not working, clean browser cache.
Clean your browser Cache or try opening a private navigation window.
Your Browser will Cache files so it doesn't have to load them every time. Usually refreshing will solve the issue but a surefire way is to enable the "disable browser cache" option in Chrome's dev console (firefox may have something similar).
When you open the dev console there is a gear in the upper right that opens the options menu. In the "General" tab the "Disable cache (while DevTools is open)" option is available. after enabling this just refresh the page with the console open and it will download all of the latest files from your server.
Did you try running ng build before uploading the website to FTP? If your website is made on Angular then ng build is must to update the new changes. I got the same problem and ng build worked for me :)

Accessing a Drive Preview from an iFrame in Chrome via SSL

I have an application that uses Google Drive for document storage and preview functionality, but recently the iFrames that the documents are loading into are not displaying anything. Upon inspection of the console, Chrome declares that it blocked the fram from running insecure content, and that is why the file preview did not load.
The initial call to preview this file is to a url that looks like this:
https://docs.google.com/document/d//preview
There is a redirect along the way that takes the following form but because it uses http instead of https, Chrome blocks the content from loading.
http://www.google.com/url?sa=p&q=https://www.google.com/accounts/ServiceLogin?service%3Dwise%26passive%3Dtrue%26go%3Dtrue%26continue%3Dhttps://docs.google.com/document/d//preview?pref%253D2%2526pli%253D1
Is there any way around this issue? It is blocking a core functionality of my application currently, so any advice would be appreciated. I can provide a screenshot of the full stack of network loads in necessary, but this is the only URL that is not http compliant.
Thanks in advance for your help.
Hacked that. Add a "?pli=1" without quotes at the end of the URL to avoid redirect (after "/preview" or "/edit") and land directly to the document.

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?