我目前的主干应用程序有一个url:
localhost/#users
Run Code Online (Sandbox Code Playgroud)
有没有办法localhost/#users在URL 访问,localhost/#users以便刷新页面?
目前,当我在localhost/#users,我尝试
window.location.hash = #users 要么 myBackboneRouter.navigate("users")
它不会触发页面刷新.
我刚刚发现,当我点击任何ASP .NET MVC页面上的浏览器后退按钮时,没有任何反应,页面也不会被更新.只有当您单击F5时,它才会更新.
主要问题是我对页面的DOM进行了一些更改,即添加表行选择单选按钮等,当我通过点击浏览器返回按钮返回页面时,我看到没有变化.
如何解决ASP .NET MVC 5?
感谢任何线索......
PS我已经阅读http://forums.asp.net/t/1304752.aspx?how+to+refresh+page+when+hitting+back+button但它没有帮助......
我有一个 Blazor 服务器应用程序,其中一个页面接受 uri 中的参数。当我单击具有路由设置的锚标记以使用参数(如下所示)访问该页面时,链接工作正常,并且页面加载。
<a href="/MyPage/{@Param1}/{@Param2}"> <!--link content in here--> </a>
Run Code Online (Sandbox Code Playgroud)
但是,如果尝试直接从该 URL 访问该页面,或者在浏览器中手动刷新,则该页面不会重新初始化或命中参数上的任何断点。相反,它会抛出 404 not found。
所以这里有两件事:
@page可以与刷新/直接网址一起正常工作时。相关页面的 Razor 和 Razor.cs:
@page "/MyPage/{Param1}/{Param2}"
<h1>MyPage</h1>
<Metrics Param1="@Param1" />
<Details Param1="@Param1" Param2="@Param2" />
<InProgress Param1="@Param1" Param2="@Param2" />
<InQueue Param1="@Param1" />
<br />
Run Code Online (Sandbox Code Playgroud)
using System;
using System.Linq;
using System.Threading.Tasks;
using System.Collections.Generic;
using Microsoft.AspNetCore.Components;
using MyApp.Data.Models.ApiResponse;
namespace MyApp.Pages
{
public partial class MyPage
{
[Parameter]
public string Param1 { get; set; …Run Code Online (Sandbox Code Playgroud) 当用户通过按后退按钮从第2页返回时,如何强制页面1的页面刷新?是否存在vbscript或javascript方法或是否以某种方式设置"无缓存"?
我创建了一个专为智能手机设计的网站(可在http://dev.gkr33.com上访问),并尝试使用navigator.geolocation api并通过getCurrentPosition获取您的位置.这似乎最初工作,但是如果你试图刷新页面,它总是带回最后的GPS位置.我在页面上添加了一些调试信息,用于获取getCurrentPosition返回的时间,在初始定位之后,它总是返回相同的时间(下降到毫秒).
这似乎只发生在Chrome Mobile中.如果我通过Android浏览器浏览网站,它每次都可以正常工作.
代码如下所示;
<script type="text/javascript">
(function ($) {
$(document).ready(function() {
var options = { enableHighAccuracy: true, maximumAge: 0, timeout: 60000 };
var position;
// empty the current html elements, not strictly necessary but
// I'm clutching at straws
$('#debug-latlng').empty();
$('#debug-time').empty();
$('#debug-address').empty();
// Let's try and find out where we are
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(gotPos, gotErr, options );
} else {
gotErr();
}
// We've got our position, let's show map and update user
function gotPos(position) {
var …Run Code Online (Sandbox Code Playgroud) 当我对angularjs应用程序进行更改时,会出现一个反复出现的问题.问题是如果我想对我所做的更改进行播种,我必须刷新页面.这是一个问题,因为我不希望我的用户必须刷新页面(他们可能不知道这样做).他们可能认为该网站已被破坏.我可以遵循某种角度指令或流程,这样我的UI更改就可以反映在我的生产服务器上而无需用户刷新页面吗?
我正在考虑这个展示:http://www.primefaces.org/showcase/ui/dynamicImage.jsf,特别是子版"GraphicText on the the-fly".
我的问题是实现这个子案例的扩展版本,增加了一个.当按下按钮时,我需要图像改变.
在DynamicImageController类中,我重新编写了与graphicImage相关联的getter:
public StreamedContent getGraphicText(){
double random = Math.random();// a double value with a positive sign, greater than or equal to 0.0 and less than 1.0.
if(random>0.5){
BufferedImage bufferedImg = new BufferedImage(100, 25, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = bufferedImg.createGraphics();
g2.drawString("This is a text", 0, 10);
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
ImageIO.write(bufferedImg, "png", os);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
graphicText = new DefaultStreamedContent(new ByteArrayInputStream(os.toByteArray()), "image/png"); …Run Code Online (Sandbox Code Playgroud) 我有一个登录API,我在我的服务中使用它
function logInToService(callback, errback, login, password, rememberLogin) {
var url = "User/Login";
var authorizationHeader = {'Authorization': "Basic " + login + ":" + password};
httpWrapperService.post(url, {login: login, password: password}, authorizationHeader).then(
function success(loginToken) {
// transform data here
self.currentUser.emailAddress = login;
self.currentUser.password = password;
// store token in a cookie
self.currentUser.token = loginToken;
$rootScope.currentUser = self.currentUser;
if (rememberLogin) {
localStorage.userName=login;
localStorage.password=password;
}
httpWrapperService.setAuthenticationToken(loginToken);
callback(loginToken);
},
function error(errorObject) {
errback(errorObject);
}
);
}
Run Code Online (Sandbox Code Playgroud)
在我的标题html中,当他登录Header.html时,我在顶部显示用户名
<div class="header-user-menu">
<div ng-show="isUserLoggedIn() == false …Run Code Online (Sandbox Code Playgroud) 我知道这已被问过太多次,而且SO充满了类似的问题.我经历了大部分时间,我已经研究了这个问题几天了,我还没有找到明确的解决方案.
我可以轻松避免添加configChanges="orientation|screenSize"到包含WebView的活动中的所有麻烦; 我已经测试了这个并且按预期工作(WebView没有重新加载).但我真的想避免这个解决方案.
这是我当前的WebView实现:
public class BrowserFragment extends Fragment {
private WebView mWebView;
public BrowserFragment() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (mWebView == null) {
mWebView = new WebView(getActivity());
}
return mWebView;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return super.shouldOverrideUrlLoading(view, url);
}
}); …Run Code Online (Sandbox Code Playgroud) 在asp.net中,当我提交表单并刷新它时,数据又重新提交了吗?在C#中有一种方法可以在页面加载时捕获页面刷新事件吗?
page-refresh ×10
javascript ×4
angularjs ×2
.net ×1
ajax ×1
android ×1
asp.net ×1
backbone.js ×1
blazor ×1
browser ×1
c# ×1
captcha ×1
geolocation ×1
html ×1
jsf-2 ×1
logout ×1
mobile ×1
primefaces ×1
refresh ×1
vbscript ×1
webview ×1