Skip to main content
1-Visitor
October 29, 2020
Question

Open external browser - not in Vuforia

  • October 29, 2020
  • 2 replies
  • 5818 views

Hi everyone, 

in my project actually I used to open a web page with the following code: 

 

$scope.app.openConfirmationPage=function(url){ //passo url con pagina per conferma dati 
	 try{
		$timeout( () => {var ref = window.location.href=url; 
 twx.app.fn.addSnackbarMessage("window.location.href="+window.location.href,"twLogo");},500) 
 	}
 	catch(e){
 	alert('redir failed ' + e); 
 	}
}

 

and it's all working fine. 

 

So, I don't want to open the browser into Vuforia View but open for example Chrome, or Safari or other platform. 

 

How could I do?

2 replies

21-Topaz I
October 30, 2020

Hi @leonardosella ,

you can try to add in your project a hyperlink widget. So far I remember (tested on IOS in the past)  this will change the behavior also when you try to open the web link  via the setting of 

 

window.location.href

 

 (so in this case the hyperlink widget could stay invisible)

1-Visitor
October 30, 2020

I don't understand. Could give me an example?

21-Topaz I
October 30, 2020

what I meant was to add a hyperlink widget to your Vuforia Studio project - no further action  else:

2020-10-30_10-34-08.jpg

So far I remember addting of this widget to the proejct will change the behavior in Vuforia View  on end device (at least I observed such behavior some time ago and therefore mention if it could be helpful in your case - but your need to test it)

I found one project  where I tested similar functionality. /attached here 

1-Visitor
November 7, 2022

window.location.replace('http://example.com');

 

It’s better than using window.location.href = ‘http://example.com’;

 

Using replace() is better because it does not keep the originating page in the session history, meaning the user won’t get stuck in a never-ending back-button fiasco.

 

If you want to simulate someone clicking on a link, use window.location.href

If you want to simulate an HTTP redirect, use window.location.replace

 

You can use assign() and replace methods also to javascript redirect to other pages like the following:

 

location.assign("http://example.com");

 

The difference between replace() method and assign() method(), is that replace() removes the URL of the current document from the document history, means it is not possible to use the “back” button to navigate back to the original document. So Use the assign() method if you want to load a new document, and want to give the option to navigate back to the original document.