English 中文(简体)
我是否应该更新所有追赶国时的hr子和rc?
原标题:Should I update all hrefs and src when doing a pushState?

如果我叫“<条码>pushState,但我想保留所有的相对联系、图像、风格和照相,那么我就这样做了:

$( [href] ).each(function() { 
    if (!/^#/.test(this.href)) this.href = this.href;
});
$( [src] ).each(function() { this.src = this.src });

我的问题是:这项工作是否跨过来? 是否需要$(this).attr(href )=这一数值?

是否有必要? 是否有其他办法这样做? 这样做的最佳方式吗? 它是否总是工作?

最佳回答

<编码>pushState 改变本文件的相对路线。

你们可以打破或避免因你如何走相对的道路而打破相对来源。

./this/would/break.jpg

/this/wont.jpg
问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签