I am creating a cordova app which opens PDF files. I am reading all the files in the device using cordova-plugin-file
and then opening them using file://
but I am getting error that Not allowed to load local resource
. I do not think it is a CORS issue because even content://
url are not working. Also, I am testing on android 11. Here’s my index.html
:-
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Security-Policy" content="default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap: content:">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, viewport-fit=cover">
<meta name="theme-color" content="#fff">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<title>S Pdf Reader</title>
<% if (TARGET === 'web') { %>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="apple-touch-icon" href="icons/apple-touch-icon.png">
<link rel="icon" href="icons/favicon.png">
<link rel="manifest" href="/manifest.json">
<% } %>
</head>
<body>
<div id="app"></div>
<% if (TARGET === 'cordova') { %>
<script src="cordova.js"></script>
<% } %>
<script type="module" src="./js/app.js"></script>
</body>
</html>