开发者

Safari 5 HTML Iframe not working properly with URL + Params

开发者 https://www.devze.com 2023-01-16 23:01 出处:网络
I have an URL in IFRAME with parameters like this: <iframe src=\"http://www.example.com/id开发者_C百科=123&place=123\"></iframe>

I have an URL in IFRAME with parameters like this:

<iframe src="http://www.example.com/id开发者_C百科=123&place=123"></iframe>

Works perfectly on FF3+, IE6+ (believe in me) and Safari 4, but in Safari 5 is different. S5 changes the URL to http://www.example.com/id=123 &amp; place=123

Someone knows how can I do a workaround to solve this headache?

tks.


What do you mean it changes the URL? Does it try and access the url http://www.example.com/id=123&amp;place=123? Or does it still try and access http://www.example.com/id=123&place=123? When I try your example pointing to localhost instead of example.com, and record the request from Safari 5, I get the ampersand &, not &amp;

$ nc -l 4242
GET /?id=123&place=123 HTTP/1.1
Host: localhost:4242
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/533.17.8 (KHTML, like Gecko) Version/5.0.1 Safari/533.17.8
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Referer: http://livedom.validator.nu/blank.html
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: keep-alive

Note that using &amp; in the URL in your source is actually the correct way to write it; if you write &, browsers will try to interpret the following text as an entity. If it cannot find a matching entity, then it will assume that you incorrectly used a raw & and will use that, but you need to be careful because you could accidentally form an entity instead of the actual ampersand you were requesting. So, to avoid possible mistakes, you actually should write &amp; in your code. If you are inspecting or serializing the DOM, such as through innerHTML, Safari may be rewriting the URL for you to correctly use &amp;, to avoid this sort of error.

0

精彩评论

暂无评论...
验证码 换一张
取 消