我有一个模态对话框,打开一个设置了dialogArguments的窗口。
页面然后从xxx / yyy /重定向到xxx / yyy / 1并且javascript抛出:
未捕获的ReferenceError:未定义dialogArguments
如何在两个页面之间传递此内容?
答案 0 :(得分:0)
您可以保存会话或Cookie。
或者......可以传递url中的参数并从新页面获取它。
示例:
xxx/yyy/ redirects xxx/yyy/1?arg1=hello&arg2=world
您可以使用以下方式获取参数:
(http://www.netlobo.com/url_query_string_javascript.html)
function gup( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return null;
else
return results[1];
}
gup(arg1)返回hello