0

Hi friends,
I want to go to previous page from a pdf document page using php. I already used the following code.

<a href='javascript:history.go(-1)'>

It only works on the web pages but it doesn't work in pdf document.

3
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by cereal
0

A PDF document is displayed by a plugin in the browser. It's not possible to control these with Javascript.

0

As workaround you can use an iframe to display the pdf and place the history.back link in the page, something like:

<html>
<head><title>go back</title></head>
<body>
    <p><a href="javascript:history.go(-1)">prev</a></p>
    <iframe width="900px" height="600px" frameborder="0" src="view.html" />
</body>
</html>

and in the view.html you place an object tag or a plugin as suggested by pritaeas:

<object width="850px" height="550px" type="application/pdf" data="/pdf/pdf_to_display.pdf"></object>

EDIT

well, I did a test.. you don't even need the iframe, just use:

<html>
<head><title>go back</title></head>
<body>
    <p><a href="javascript:history.go(-1)">prev</a></p>
    <object width="850px" height="550px" type="application/pdf" data="/pdf/pdf_to_display.pdf"></object>
</body>
</html>

bye!

Edited by cereal

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.