Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
Posts: 163
Registered: ‎05-06-2011
My Device: Playbook
My Carrier: Not Specified
Accepted Solution

Issue with document.referrer in Playbook

Hi,

 

The javascript property document.referrer is returning empty value in my app when I navigate between pages. It is supposed to return the previous page url. But this is working fine in inbuilt browser of Playbook when I access the page using a local server setup. Any thoughts on this?

 

Thanks in advance

Praveen

Retired
Posts: 172
Registered: ‎06-07-2010
My Device: BlackBerry 8520
My Carrier: Rogers

Re: Issue with document.referrer in Playbook

Hello Praveen,

 

How are you doing? I hope all is well.

 

Can you provide a sample code to easily reproduce this issue. From my tests, I've not seen any issue.

 

Looking forward to your reply.

Raihan Masroor
BlackBerry Development Advisor
Developer
Posts: 163
Registered: ‎05-06-2011
My Device: Playbook
My Carrier: Not Specified

Re: Issue with document.referrer in Playbook

[ Edited ]

Hi Raihan,

 

Let me explain it with some sample codes.

 

This is my first HTML file -- index.html

<html>
<head>
<title>Sample</title>
</head>
<body>
Index.html
<a href="next.html">Next</a>
</body>
</html>

 

and my second HTML file -- next.html

<html>
<head>
<title>Sample Next</title>
<script src="jquery.js"></script>
<script>
$(document).ready(function(){
alert(document.referrer);
});
</script>
</head>
<body>
Next Page
</body>
</html>

 

When I navigate from index.html to next.html in my browser setup with local server, I get the url as 'http://localhost/sample/index.html'. But it returns empty value when i navigate the same in playbook.  I'm not sure if this is an undesierable effect. Please let me know your thought on this.

 



Retired
Posts: 172
Registered: ‎06-07-2010
My Device: BlackBerry 8520
My Carrier: Rogers

Re: Issue with document.referrer in Playbook


Hey Praveen,

 

Thanks for the snippets for which I now have a much better understanding what you are trying to do.

 

The document.referrer value coms from an http response header that gets populated only by a Web Server. This is the reason why I wasn't able to reproduce from the Browser on the PlayBook.

 

Local WebWorks content does not use a Web Server and so this value is empty.

 

I hope I have clarified your issue.

Raihan Masroor
BlackBerry Development Advisor