question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting defaultUrl has no effect

See original GitHub issue

Steps to reproduce:

Download 2.0 https://github.com/mozilla/pdf.js/releases/download/2.0.550/pdfjs-2.0.550-dist.zip

Edit viewer.html:

<script> AppOptions.set('defaultUrl', 'test.pdf'); </script>

Result: ReferenceError: Can’t find variable: AppOptions

Expected Result: Load test.pdf

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13

github_iconTop GitHub Comments

3reactions
hoangeminicommented, Feb 13, 2019

After reading through the Issue related to defaultUrl and I know how to solve the problem, it works well!

File viewer.js config

Delete string ‘compressed.tracemonkey-pldi-09.pdf’ in defaultUrl We will be like this

defaultUrl: {
    value: '',
    kind: OptionKind.VIEWER
 }

File viewer.html

<script>
        window.addEventListener('load', function() {
            PDFViewerApplication.open('you_custom_file.pdf')
        });
 </script>
1reaction
prohtexcommented, Jun 27, 2018

For the curious, this would be how to set DEFAULT_URL in the header of viewer.html:

<script> $(document).ready(function() { PDFViewerApplicationOptions.set('defaultUrl', '<?=$file;?>'); }); </script>

Read more comments on GitHub >

github_iconTop Results From Across the Web

asp.net - Default url property is not working when redirecting
It seems, that the user with this username/password doesn't have access to the Admin/AdminHome.aspx page. That's why you've been redirected ...
Read more >
SharePoint 2019 Change the default URL
Add a new URL in Central Admin -> System Settings -> Uner Farm Management ... SharePoint will not let you delete the Default...
Read more >
Chrome Sign Builder Default URL Refresh - Chrome Enterprise ...
However, I have not seen a setting to change how often the default URL is refreshed? For example, if they change their slides...
Read more >
How to change default URL for guest users. - Forums - Liferay
I'm not looking for virtual host. Say when I use default URL http://111.111.111.70:8080/ it is adding /web/guest and displaying page. Where I need...
Read more >
Setting up Google Analytics default URL | SEO Forum - Moz
If someone has set: the default url in Google Analytics to a non-www ... What I'll emphasize is that your Default URL value...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found