How do I prevent visitors from opening a page outside iframe
By : Sanaz Shaban
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , Since an iframe makes a GET request there isn't really any way to distinguish a GET request coming from the browser itself and one coming from an iframe embedded in a page. In both cases the browser makes the same GET request. You could probably write some JavaScript code in your "iframe" page that detects whether or not it is loaded in the top window and redirects if it isn't. From the accepted answer on How to identify if a webpage is being loaded inside an iframe or directly into the browser window? code :
<script type="text/javascript">
if (top === self) {
location = '/index.php';
}
</script>
|
Is there a way to prevent the download page from opening in R Shiny?
By : Siva Rohith Palla
Date : March 29 2020, 07:55 AM
like below fixes the issue Vincent's solution using two buttons, an action button for the calculation and a download button for the download is the one I went with. An additional bonus to this solution is the progress bar that also comes in the shinyIncubator package. An explanation of my code incase someone else wants to do the same thing: code :
actionButton("makePlots", "Calculate Results"),
uiOutput("download_button")
mainPanel(
progressInit(),
uiOutput("mytabs")) # dynamic rendering of the tabs
output$download_button <- renderUI({
if(download){
downloadButton("downloadPlots", "Download Results")
}
})
makePlots<-reactive({
if(input$makePlots>counter){ # tests whether action button has been clicked
dir.create("new_directory_for_output")
withProgress(session, min=1, max=15, expr={ # setup progress bar
for(i in 1:15){
png(paste0("new_directory_for_output/plot",i,".png"))
plot(i)
dev.off()
setProgress(message = 'Calculation in progress',
detail = 'This may take a while...',
value=i)
} # end for
}) # end progress bar
counter<<-counter+1 # needs the <<- otherwise the value of counter
# is only changed within the function
download<<-TRUE # something to download
} # end if
}) # end function
output$downloadPlots <- downloadHandler(
filename = function() { my_filename.zip },
content = function(file){
fname <- paste(file,"zip",sep=".")
zip(fname,new_directory_for_output) # zip all files in the directory
file.rename(fname,file)
unlink(new_directory_for_output,recursive = TRUE) # delete temp directory
download<<-FALSE # hide download button
}
) # end download handler
|
Prevent opening page without login
By : phisikus
Date : March 29 2020, 07:55 AM
With these it helps You need to check, on every request that requires a login, that the user is logged in and is authorized. A good way of looking at this is seeing the request URL as part of the input to your program. Just like the cookies and GET/POST parameters are input.
|
How to find WPF Page in navigation history to prevent opening the page again
By : user2109232
Date : March 29 2020, 07:55 AM
hop of those help? Pages are rarely used in commercial apps. As I understand it, they were really intended for xbap ( wpf in a browser ). It's much more usual to have usercontrols hosted in a contentcontrol. In which case there are two commonly used alternatives 1) View First. Hold a dictionary of usercontrols keyed by type. https://gallery.technet.microsoft.com/WPF-Navigation-Basic-Sample-11f10c74 code :
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
Navigate(typeof(HomeView));
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Button btn = (Button)e.OriginalSource;
Navigate(btn.Tag as Type);
}
private void Navigate (Type viewType)
{
UserControl uc;
if (Views.ContainsKey(viewType))
{
uc = Views[viewType];
}
else
{
uc = (UserControl)Activator.CreateInstance(viewType);
Views[viewType] = uc;
}
NavigationParent.Content = uc;
}
private Dictionary<Type, UserControl> Views = new Dictionary<Type, UserControl>();
}
|
prevent page opening on an iframe?
By : Kath27
Date : March 29 2020, 07:55 AM
may help you . How can I prevent page opening on an iframe using PHP? Like Gmail inside an iframe? , For PHP, you can use.
|