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
New Developer
pnewhook
Posts: 70
Registered: ‎01-13-2011
My Device: Torch 9800 and Playbook

How Can I Redirect to a Page in My WebWorks App from and External Site

I have an entire functioning client side only OAuth flow working on my desktop browser. My next step is to make that work in a PlayBook WebWorks app. I can make it to the twitter authorization page, but after I authenticate Twitter can't redirect me to to my page at local:///index.html

 

Is there another way to directly access WebWorks app files?

Retired
jeffheifetz
Posts: 518
Registered: ‎07-18-2011
My Device: Bold

Re: How Can I Redirect to a Page in My WebWorks App from and External Site

Hi pnewhook,

 

I believe something like the snippet below should work for you

window.location = window.location.origin + window.location.pathname.replace("oauth2callback.html", "index.html");

 



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
New Developer
pnewhook
Posts: 70
Registered: ‎01-13-2011
My Device: Torch 9800 and Playbook

Re: How Can I Redirect to a Page in My WebWorks App from and External Site

Sorry, I don't think I explained my problem well enough. My problem lies in the fact that Twitter wants to redirect me to http://index.html in favour of 'local://' even though I've explicitly stated local:///index.html is where I want to go. 

 

I have this working on a local webserver using localhost, but that's ultimately over HTTP, is there a way to refer to a file in a WebWorks application with an http address?

Developer
interfaSys
Posts: 817
Registered: ‎11-19-2009
My Device: Z10, Q10, 9900, 9790, PlayBook,

Re: How Can I Redirect to a Page in My WebWorks App from and External Site

You simply have to give a callback parameter to Twitter.

--
Olivier - interfaSys ltd
Developing for BlackBerry 10 devices using the Sencha Touch framework.
New Developer
pnewhook
Posts: 70
Registered: ‎01-13-2011
My Device: Torch 9800 and Playbook

Re: How Can I Redirect to a Page in My WebWorks App from and External Site

Hi interfaSys, I do give a callbackUrl to twitter, but the problem is because that's a page in a local application, twitter doesn't want to redirect to it. I need some way of aliasing local files to HTTP addresses, like localhost on a desktop.

Developer
interfaSys
Posts: 817
Registered: ‎11-19-2009
My Device: Z10, Q10, 9900, 9790, PlayBook,

Re: How Can I Redirect to a Page in My WebWorks App from and External Site

[ Edited ]

Have you tried with 127.0.0.1 or local:/index.html (single slash)?

What does 'location.href' return?

 

(I'm not in front of a dev env atm and use oob for now)

--
Olivier - interfaSys ltd
Developing for BlackBerry 10 devices using the Sencha Touch framework.
Developer
interfaSys
Posts: 817
Registered: ‎11-19-2009
My Device: Z10, Q10, 9900, 9790, PlayBook,

Re: How Can I Redirect to a Page in My WebWorks App from and External Site

I just did a test and after authorization, Twitter loaded index.html at local:///index.html.

--
Olivier - interfaSys ltd
Developing for BlackBerry 10 devices using the Sencha Touch framework.