简体   繁体   English

将URL参数传递到Internet Explorer上的Iframe

[英]Passing URL parameters to Iframe on Internet Explorer

I'm trying to pass some parameters to an Iframe and it works fine in all browsers, except IE. 我正在尝试将一些参数传递给iframe,它在IE以外的所有浏览器中都能正常工作。

I couldn't find any other solution for what I'm trying to do, but maybe IE doesn't accept parameters to be sent to an iframe? 我找不到其他解决方案,但是IE可能不接受要发送到iframe的参数?

This is what I have: 这就是我所拥有的:

 <iframe src="https://portal.maxistore.com.br/dologin.php?
 email=<?php echo urlencode($user_info->user_login) ?>&timestamp=<?php echo urlencode($timestamp) ?>&hash=<?php echo $hash ?>&goto=<?php echo urlencode($goto_invoices) ?>" name="iframeTarget" id="iframeTarget" width="100%" height="1200px"></iframe>    

Thank you. 谢谢。

My answer has nothing to do with IE compatibility directly... I just wanted to point out a much more efficient way to build urls. 我的回答与IE兼容性没有直接关系...我只是想指出一种构建URL的更有效的方法。 Although, it may be beneficial to do it the proper way and eliminate the margin for error when building your urls. 虽然,这样做可能是有益的,并且以适当的方式消除构建URL时的错误余量。

With the use of http_build_query and sprintf you can build dynamic encoded urls with a single function versus all this interdom php code. 通过使用http_build_querysprintf您可以使用一个函数来构建动态编码的url,而不是使用所有这些相互之间的php代码。 Check it out: 看看这个:

Example

$Data = [
    'timestamp' => time(),
    'id' => 64,
    'email' => 'bobbyryan@aol.com',
];

$url = http_build_query($Data);

echo sprintf("http://www.example.com/?%s", $url);

Results in the following URL 结果显示在以下URL中

http://www.example.com/?timestamp=1367951475&id=64&email=bobbyryan%40aol.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM