重装问题 [英] Problem with reload
问题描述
嘿大家,
我正在编写一个脚本,将当前页面打开到一个新窗口
,带有不同的打印样式表,不要问我为什么需要
打开一个新窗口,这是权力的要求!无论如何
当我在IE中重新加载页面时它很好但在FF中它似乎渲染
没有样式表的html !! ??我想可能是用新窗口在FF中缓存
问题,但我不确定。下面是我写的代码
写的:
var w,d,copy;
//
函数printPage()
{
document.getElementById(''pageTitle'')。innerHTML = document.title;
w = window.open('''','''','''');
d = w.document;
copy ="< html> \ n< head> \ n< title>" + document.title +"< / title> \ n" ;;
copy + ="< link id =' 'globalStyleSheet''type =''text / css''rel ='''stylesheet''
href =''css / globalPrint.css''/> \\\
" ;;
copy + ="< link id =''docStyleSheet''type =''text / css''rel ='''stylesheet''
href =''" + document.getElementById(''docStyleSheet'')。h ref +"''/>" ;;
copy + ="< script language =''javascript''type = ''text / javascript''
src =''scripts / j s / utils.js''>< / script> \ n" ;;
copy + =" \ n< / head>" ;;
copy + =" \ n< body>" ;;
copy + = document.body.innerHTML;
copy + =" \\\
< / body> ; \ n< / html>" ;;
d.write(copy);
d.close();
}
函数init()
{
document.getElementById(''printLink'')。onclick = function (){
printPage();
返回false;
}
}
我现在已经绞尽脑汁待了几天,最后来到了
a砖上来解决这个问题..
任何帮助或你的想法将不胜感激:)
干杯
Hey everyone,
I''m writing a script that opens the current page into a new window
with a different style sheet for printing, don''t ask me why it needs
to open into a new window, it''s a request from powers that be! Anyway
when I reload the page in IE it''s fine but in FF it seems to render
the html without a style sheet!!?? I think it may be to do a caching
problem in FF with new windows but I''m not sure. Heres the code I''ve
written:
var w, d, copy;
//
function printPage()
{
document.getElementById(''pageTitle'').innerHTML = document.title;
w = window.open('''', '''' ,'''');
d = w.document;
copy = "<html>\n<head>\n<title>"+document.title+"</title>\n";
copy += "<link id=''globalStyleSheet'' type=''text/css'' rel=''stylesheet''
href=''css/globalPrint.css'' />\n";
copy += "<link id=''docStyleSheet'' type=''text/css'' rel=''stylesheet''
href=''"+document.getElementById(''docStyleSheet'').h ref+"'' />";
copy += "<script language=''javascript'' type=''text/javascript''
src=''scripts/js/utils.js''></script>\n";
copy += "\n</head>";
copy += "\n<body>";
copy += document.body.innerHTML;
copy += "\n</body>\n</html>";
d.write(copy);
d.close();
}
function init()
{
document.getElementById(''printLink'').onclick = function(){
printPage();
return false;
}
}
I''ve been racking my brain for a few days now and have finally come to
a brick for a work around..
Any help or your thoughts would be much appreciated :)
Cheers
推荐答案
2月20日上午10点23分,DoomedLung < doomedl ... @ googlemail.comwrote:
On Feb 20, 10:23 am, "DoomedLung" <doomedl...@googlemail.comwrote:
大家好,
我正在编写一个脚本将当前页面打开到一个新窗口
用不同的打印样式表,不要问我为什么需要
打开一个新窗口,它'这是权力的要求!无论如何
当我在IE中重新加载页面时它很好但在FF中它似乎渲染
没有样式表的html !! ??我想可能是用新窗口在FF中缓存
问题,但我不确定。 ...
Hey everyone,
I''m writing a script that opens the current page into a new window
with a different style sheet for printing, don''t ask me why it needs
to open into a new window, it''s a request from powers that be! Anyway
when I reload the page in IE it''s fine but in FF it seems to render
the html without a style sheet!!?? I think it may be to do a caching
problem in FF with new windows but I''m not sure. ...
< snip>
更有可能是样式表的相对URL问题
相对于页面URL而不是您期望的URL。
尝试添加BASE元素来断言相对的起点
页面上的URL(或使用绝对URL)。
Richard。
<snip>
More likely it is an issue with the relative URL for the style sheet
being relative to a page URL that is not the URL you are expecting.
Try adding a BASE element to assert the starting point for relative
URLs on the page (or use absolute URLs).
Richard.
2月20日,10:凌晨40点,Richard Cornford < Rich ... @ litotes.demon.co.uk>
写道:
On Feb 20, 10:40 am, "Richard Cornford" <Rich...@litotes.demon.co.uk>
wrote:
2月20日上午10:23, " DoomedLung" < doomedl ... @ googlemail.comwrote:大家好,
On Feb 20, 10:23 am, "DoomedLung" <doomedl...@googlemail.comwrote:Hey everyone,
我正在编写一个脚本,将当前页面打开到一个新窗口
带有不同的打印样式表,不要问我为什么需要打开一个新窗口打开
,这是权力要求!无论如何
当我在IE中重新加载页面时它很好但在FF中它似乎渲染
没有样式表的html !! ??我想可能是用新窗口在FF中缓存
问题,但我不确定。 ...
I''m writing a script that opens the current page into a new window
with a different style sheet for printing, don''t ask me why it needs
to open into a new window, it''s a request from powers that be! Anyway
when I reload the page in IE it''s fine but in FF it seems to render
the html without a style sheet!!?? I think it may be to do a caching
problem in FF with new windows but I''m not sure. ...
< snip>
更有可能是样式表的相对URL问题
相对于页面URL而不是您期望的URL。
尝试添加BASE元素来断言相对的起点
页面上的URL(或使用绝对URL)。
Richard。
<snip>
More likely it is an issue with the relative URL for the style sheet
being relative to a page URL that is not the URL you are expecting.
Try adding a BASE element to assert the starting point for relative
URLs on the page (or use absolute URLs).
Richard.
嘿理查德,谢谢你的快速回复!不幸的是我已经尝试过使用绝对URL路由的
(因为我不知道BASE
元素是什么?我真的应该!)并且无济于事。重装后,FF仍然会在没有样式表的情况下呈现
页面!! ?? :(
Hey Richard, thanks for your speedy reply! Unfortunately I''ve tried
going with the absolute URL route (because I don''t know what BASE
elements are? I really should!) and to no avail. FF still renders the
pages without a style sheet after reload!!?? :(
2月20日上午10点40分,Richard Cornford< Rich ... @ litotes.demon.co.uk>
写道:
On Feb 20, 10:40 am, "Richard Cornford" <Rich...@litotes.demon.co.uk>
wrote:
2月20日上午10:23,DoomedLung< doomedl ... @ googlemail.comwrote:嘿大家,
On Feb 20, 10:23 am, "DoomedLung" <doomedl...@googlemail.comwrote:Hey everyone,
我正在编写一个脚本,将当前页面打开到一个新窗口
,带有不同的打印样式表,不要问我为什么需要
打开一个新窗口,这是来自权力的请求!无论如何
当我重新加载页面时IE它很好,但在FF中似乎渲染
html没有样式表!! ??我认为它可能是做一个缓存
问题带有新窗户的FF,但我不确定。...
I''m writing a script that opens the current page into a new window
with a different style sheet for printing, don''t ask me why it needs
to open into a new window, it''s a request from powers that be! Anyway
when I reload the page in IE it''s fine but in FF it seems to render
the html without a style sheet!!?? I think it may be to do a caching
problem in FF with new windows but I''m not sure. ...
< snip>
更有可能样式表的相对URL是一个问题
是相对于页面URL的不是你期望的URL。
尝试添加一个BASE元素来断言页面上相对
URL的起点(或使用绝对URL)。
理查德。
<snip>
More likely it is an issue with the relative URL for the style sheet
being relative to a page URL that is not the URL you are expecting.
Try adding a BASE element to assert the starting point for relative
URLs on the page (or use absolute URLs).
Richard.
嘿理查德。我在文档中添加了一个BASE元素,但仍然没有快乐!?
FF仍然会在没有应用样式表的情况下呈现页面!! ??
Hey Richard. I added a BASE element in the document but still no joy!?
FF still renders the page with out the style sheets applied!!??
这篇关于重装问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!