TheSaint Posted June 10, 2021 Share Posted June 10, 2021 (edited) This is a simple but somewhat tricky to do script, that I whipped up in a few hours due to a need. I share, because it would no doubt be helpful to some others, and one of those might even make improvements. Basically, I sometimes need to save web pages ... for a game etc, so I have something I can check or refer to later, about the game. I store the save(s) in a sub-folder of my game folder, called '_Html'. I backup (archive) my game folders after downloading, to a few external drives. Sometimes, not all that often thankfully, file contents of the saved web page folder result in a too long path ... greater than 255 characters. Usually it is an image file that is the culprit, and clearly web browsers are not smart enough to prevent that. It is a problem however when backing up to another drive, even when you kind of mirror the folder paths. For instance, I download to a folder in My Documents, called Downloads and which contains date folders. i.e. C:\Users\TheSaint\Downloads\2021\02\10 And my backups folders imitate that with a shorter version. i.e. D:\Downloads\2021\02\10 So even though the backup folder path is shorter, the source folder path creates an issue and some files are not backed up. I then have 3 choices. (1) Skip the files, losing them forever. (2) Rename the files to shorter names so they at least exist at the destination. (3) Rename the files and rename the matching file entries in any related htm/html files, so that everything still works. My program does option (3) or at least tries to. It isn't foolproof, as that could get quite complex. Unless you download in a very similar way to me, you will need to modify the script, path wise. A fuller folder download path for me, would be like the following. C:\Users\TheSaint\Downloads\2021\02\10\GoG\Irony Curtain - From Matryoshka with Love - Revolutionary Edition\_Html That last folder name, '_Html' is important to my script. So if you don't use that, you would need to adjust for your scenario. Here is a recent file I had the issue with. This is its shortened version. The fuller version had something like 20 or so more characters to the file name, which made the path too long. C:\Users\TheSaint\Downloads\2021\02\10\GoG\Irony Curtain - From Matryoshka with Love - Revolutionary Edition\_Html\Irony Curtain_ From Matryoshka with Love - Original Soundtrack on GOG.com_files\7ca6665e4e388a8850f76d1a792d47db1abaae3dae7996263fb835d.jpg Most of the files in the same folder were much shorter names. All up though, there was 6 image files that had names too long. There was 7 instances in html files that needed adjusting for the shortened names. My program uses a drop box, and interestingly, the too long file name result (@GUI_DragFile) resulted in a Windows short name, which I then had to cater for. One other thing I should probably make clear. If you discovered the issue after a move process, then you will need to restore web folder contents, from destination to the source folder, that did move successfully, before you use my script. Not an issue with a copy process. Basically you drag & drop the errant file onto my program drop box, and it will start checking and renaming. If an error occurs or renaming isn't needed, you will be told. Result is shown in the drop box. More than one same named problem file somewhere in the folder hierarchy, will cause an error. This is deliberate to prevent internal html path errors, due to _ReplaceStringInFile being used. If someone wants to whip up something smarter, be my guest. Currently for my use, it has been working well enough. expandcollapse popup;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; AutoIt Version: 3.3.14.2 ;; ;; ;; ;; Template AutoIt script. ;; ;; ;; ;; AUTHOR: TheSaint ;; ;; ;; ;; SCRIPT FUNCTION: Rename (shorten) a file name in a too long web folder path ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; GUI FUNCTIONS ; DropboxGUI() #include <Constants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <Array.au3> #include <File.au3> #include <Misc.au3> _Singleton("shorten-web-filename-thsaint") Global $inifle, $version, $winpos $inifle = @ScriptDir & "\Settings.ini" $version = "v1.0" DropboxGUI() Exit Func DropboxGUI() Local $Label_drop, $Dropbox Local $attrib, $f, $fext, $file, $files, $fldpth, $flepth, $found, $left, $length, $longpth, $name, $p, $pages Local $part, $path, $relpth, $rename, $rep, $result, $right, $success, $target, $top, $webpage ; $right = @DesktopWidth - 87 $left = IniRead($inifle, "Dropbox Window", "left", $right) $top = IniRead($inifle, "Dropbox Window", "top", 27) $Dropbox = GuiCreate("Dropbox", 82, 70, $left, $top, $WS_OVERLAPPED + $WS_CAPTION + $WS_SYSMENU + $WS_VISIBLE _ + $WS_CLIPSIBLINGS, $WS_EX_ACCEPTFILES + $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW) ; $Label_drop = GUICtrlCreateLabel("", 0, 0, 80, 68, $SS_CENTER + $SS_NOTIFY) GUICtrlSetState($Label_drop, $GUI_DROPACCEPTED) GUICtrlSetFont($Label_drop, 8, 400) GUICtrlSetTip($Label_drop, "Drop a Folder or Drive Here!") ; ; SETTINGS $target = "Drop a Web" & @LF & "File HERE" GUICtrlSetData($Label_drop, @LF & $target) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ; Close the Dropbox $winpos = WinGetPos($Dropbox, "") $left = $winpos[0] If $left < 0 Then $left = 2 ElseIf $left > @DesktopWidth - $winpos[2] Then $left = @DesktopWidth - $winpos[2] EndIf IniWrite($inifle, "Dropbox Window", "left", $left) $top = $winpos[1] If $top < 0 Then $top = 2 ElseIf $top > @DesktopHeight - $winpos[3] Then $top = @DesktopHeight - $winpos[3] EndIf IniWrite($inifle, "Dropbox Window", "top", $top) ; GUIDelete($Dropbox) ExitLoop Case $msg = $GUI_EVENT_DROPPED ; Folder added as new destination by drag and drop If @GUI_DragId = -1 Then If FileExists(@GUI_DragFile) Then $attrib = FileGetAttrib(@GUI_DragFile) If StringInStr($attrib, "D") > 0 Then MsgBox(262192, "Drag Error", "Needs to be a file not a folder.", 0, $Dropbox) Else GUICtrlSetData($Label_drop, @LF & $target) GUICtrlSetState($Label_drop, $GUI_DISABLE) SplashTextOn("", "Checking File Name!", 180, 80, -1, -1, 33) $path = @GUI_DragFile $longpth = FileGetLongName($path) $file = StringSplit($longpth, "\", 1) $file = $file[$file[0]] $fldpth = StringTrimRight($longpth, StringLen($file)) $length = StringLen($longpth) If $length > 254 Then $pages = "" $rep = "" $result = 0 $fext = StringSplit($file, ".", 1) If $fext[0] > 1 Then $fext = "." & $fext[$fext[0]] Else $fext = "" EndIf $name = StringTrimRight($file, StringLen($fext)) While 1 $name = StringTrimRight($name, 1) If $name > "" Then $rename = $name & $fext $flepth = $fldpth & $rename $length = StringLen($flepth) If $length < 255 Then If Not FileExists($flepth) Then $part = StringSplit($longpth, "\_Html", 1) $part = $part[1] & "\_Html" $files = _FileListToArrayRec($part, "*" & $fext, 1, 1, 0, 0) For $f = 1 To $files[0] $found = $files[$f] If StringInStr($found, $file, 1) > 0 Then $result = $result + 1 EndIf Next ;MsgBox(262192, "Check Results", "Name = " & $file & @LF & "Rename = " & $rename & @LF & "Length = " & $length & @LF & "Files = " & $result, 0, $Dropbox) If $result = 1 Then $result = 0 ;FileCopy($path, @ScriptDir & "\xxxxx.tmp", 1) ;$shortpth = FileGetShortName($flepth) ;$success = FileCopy($path, $flepth, 0) $success = FileMove($path, $flepth, 0) If $success = 1 Then $files = _FileListToArrayRec($part, "*.htm*", 1, 1, 0, 1) For $f = 1 To $files[0] $relpth = $files[$f] If StringRight($relpth, 4) = ".htm" Or StringRight($relpth, 5) = ".html" Then If $pages = "" Then $pages = $relpth Else $pages = $pages & "|" & $relpth EndIf EndIf Next ;MsgBox(262192, "Page Results", "Pages = " & $pages, 0, $Dropbox) $pages = StringSplit($pages, "|", 1) For $p = 1 To $pages[0] $webpage = $part & "\" & $pages[$p] ;MsgBox(262192, "Web Page", $webpage, 0, $Dropbox) $rep = _ReplaceStringInFile($webpage, $file, $rename) $result = $result + $rep Next Else MsgBox(262192, "File Rename Failure", "Original Path = " & $longpth & @LF & "Rename Path = " & $flepth, 0, $Dropbox) EndIf Else MsgBox(262192, "File Rename Failure", "More than one copy of the file exists or is too similar.", 0, $Dropbox) EndIf ExitLoop EndIf EndIf Else MsgBox(262192, "File Rename Failure", "File name became too short (folder name[s] too long).", 0, $Dropbox) ExitLoop EndIf WEnd Else MsgBox(262192, "File Rename Skipped", $longpth & @LF & @LF & "File name & path is short enough = " & $length, 0, $Dropbox) EndIf GUICtrlSetData($Label_drop, @LF & $target & @LF & $result & " && " & $success) SplashOff() GUICtrlSetState($Label_drop, $GUI_ENABLE) EndIf Else MsgBox(262192, "Drag Error", "Drag & Drop path doesn't exist.", 0, $Dropbox) EndIf Else MsgBox(262192, "Drag Error", "Drag & Drop failed.", 0, $Dropbox) EndIf Case Else ;;; EndSelect WEnd EndFunc ;=> DropboxGUI Enjoy! Edited June 10, 2021 by TheSaint coffeeturtle and TheDcoder 2 Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
Exit Posted June 10, 2021 Share Posted June 10, 2021 or just enable long pathnames Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem] "LongPathsEnabled"=dword:00000001 coffeeturtle, TheSaint and TheDcoder 2 1 App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
TheDcoder Posted June 10, 2021 Share Posted June 10, 2021 @TheSaint I know that you have used an addon called "SingleFile" in the past, and you probably considered it for this issue, but can you share the reason why you didn't choose to use that to solve the issue? And with my limited experience, it also does a better job of preservation than the native "save page" option by embedding all media into the same HTML file. JockoDundee 1 EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
TheSaint Posted June 11, 2021 Author Share Posted June 11, 2021 @TheDcoder - Surely you remember that was quite a while ago, and when I was still using Firefox, which wasn't saving web pages properly. I am using Brave now, have been for ages, and it saves web pages properly ... this path issue aside. That Firefox addon worked as a solution, but it was quite painful to use, so no, I never even considered using it, especially as I am not looking for another way to save web pages, and the path issue doesn't come up very often. My preference is to always go vanilla unless I have a good enough reason not to. The less addons the better ... that's if that one is even available for a Chrome clone. JockoDundee 1 Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
TheSaint Posted June 11, 2021 Author Share Posted June 11, 2021 9 hours ago, Exit said: or just enable long pathnames Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem] "LongPathsEnabled"=dword:00000001 I am presuming that stops the error when copying or moving. I have a vague recollection of changing that setting many years ago on an older Windows version. So a solution of sorts, though more like a localized bandaid than a cure, and I'm not sure I want to obscure the issue that way. Every PC my files are likely to turn up on, would have to have that enabled I am guessing ... unless latest Windows has it enabled by default. I may not be around or recall that setting when my kids inherit my game files. But thanks anyway. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
Gianni Posted June 11, 2021 Share Posted June 11, 2021 Couldn't the FileGetShortName and FileGetLongName functions be useful for this as well? TheSaint 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
JockoDundee Posted June 11, 2021 Share Posted June 11, 2021 _Singleton("shorten-web-filename-thsaint") Even thsaint himself cannot escape the dreaded shortener TheDcoder and TheSaint 2 Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
TheDcoder Posted June 11, 2021 Share Posted June 11, 2021 2 hours ago, TheSaint said: My preference is to always go vanilla unless I have a good enough reason not to. The less addons the better ... that's if that one is even available for a Chrome clone. Well, it sounds to me that a path issue is a pretty solid reason And yes, the addons works on Chromium-based browsers, check the GitHub page. TheSaint 1 EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
JockoDundee Posted June 11, 2021 Share Posted June 11, 2021 2 hours ago, TheDcoder said: Well, it sounds to me that a path issue is a pretty solid reason That might be true, but before we really push the issue, let’s appreciate the degree of cognitive dissonance that any one of us might feel had we been the one to just have whipped out some piece of slick code; and were joyfully expecting to do battle over exactly how slick it was; when to our surprise we are presented with various trivial but possibly viable solutions, which, even if ultimately found wanting, will substantially delay the start of our debate on code slickness. After all this is not General Help, but Example Scripts; and surely if the illustrative code that has been presented is scrutinized for any period of time, we shall find ample fodder for an opening salvo - the likes of which the OP has been ready and waiting to return fire for some time now TheDcoder and TheSaint 2 Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
TheSaint Posted June 12, 2021 Author Share Posted June 12, 2021 23 hours ago, Chimp said: Couldn't the FileGetShortName and FileGetLongName functions be useful for this as well? I actually use FileGetLongName in my code and would have also used FileGetShortName, but it wasn't needed. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
TheSaint Posted June 12, 2021 Author Share Posted June 12, 2021 (edited) 23 hours ago, TheDcoder said: Well, it sounds to me that a path issue is a pretty solid reason And yes, the addons works on Chromium-based browsers, check the GitHub page. Goodo .... but like I said ... painful ... slow even and clunky. So not solid enough, and wouldn't be needed very often, and also no guarantee it fixes the issue. Have you tried it? It saves a single zip like file, but does it correct path names? I certainly cannot be bothered to chase it all down and test. I save a lot of web pages, and so the slowness and fuss would be a penalty I don't want, as each page won't tell me it has a naming length issue, so I would need to do every one just in case .... No Thanks! I am happy to react and fix after TeraCopy advises me. As I keep trying to tell you bud - Simple is best. What Exit suggested is the simplest fix, but it might bite further down the track. Hell, I'd even forgotten about the existence of that fix ... and therein lies the problem, certainly if I share beyond myself. Edited June 12, 2021 by TheSaint JockoDundee 1 Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
TheDcoder Posted June 12, 2021 Share Posted June 12, 2021 4 minutes ago, TheSaint said: Have you tried it? I just did, it didn't take too long, most of the time it was saving (compressing) those images. The result is a visually perfect replica of this page. 5 minutes ago, TheSaint said: It saves a single zip like file That's a bit oversimplifying it, the result is a HTML file, but with embedded compressed content in it, which is decoded by the browser when opening the file, not really ZIP. 6 minutes ago, TheSaint said: but does it correct path names? Yes, you can fully configure the generated file name, it even has the option to set the max length No additional files are generated, it's just a single file with everything in it. EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
TheSaint Posted June 12, 2021 Author Share Posted June 12, 2021 (edited) Well good for you DC. However, I won't be using it for all the other reasons I said. And remember, I am talking about this PC, not how fast it is on yours. I also found it clunky etc. I demand simplicity not fussing around ... especially for something I do a lot of. I also recall that Addon had issues, and you may remember the many emails I had with the developer back then ... sometimes it would just fail and keep failing for a specific page (i.e. at Steam). P.S. How slow that file saving was and the odd failure, was one of the reasons I finally ditched Firefox and started using Brave. P.S.S. Sometimes the cure is worse than the problem. Edited June 12, 2021 by TheSaint TheDcoder 1 Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
JockoDundee Posted June 12, 2021 Share Posted June 12, 2021 On 6/10/2021 at 9:34 PM, TheSaint said: ...unless latest Windows has it enabled by default. I may not be around or recall that setting when my kids inherit my game files. Just out of curiosity, do you expect the saving and archiving of web pages with long path names to continue posthumously? Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
TheSaint Posted June 13, 2021 Author Share Posted June 13, 2021 On 6/12/2021 at 6:16 PM, JockoDundee said: Just out of curiosity, do you expect the saving and archiving of web pages with long path names to continue posthumously? Not entirely sure what you mean by that, but I'll elaborate on what I meant by it. One day, I'll either be gone (passed on ... dead as a dodo) or perhaps missing too many marbles before that, and my kids will essentially inherit my media files. So when it comes to my games, I save the game's web page for that version of the game, for future reference, which could be helpful ... certainly helpful for me when I catalog on a different PC or perhaps need to troubleshoot etc. You can see it as a form of future-proofing for the DRM-Free games I have bought. TheDcoder 1 Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
JockoDundee Posted June 13, 2021 Share Posted June 13, 2021 6 minutes ago, TheSaint said: So when it comes to my games, I save the game's web page for that version of the game... My point was only that if the actual action of saving of the long-named files is not a process likely to be passed on to your kin, then the issue of anyone (besides you) having to “recall that setting” may not be an issue... Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
TheSaint Posted June 13, 2021 Author Share Posted June 13, 2021 It would depend on what they do with the files. If they are wise, they will back up their single copies to other drives ... and therein lies the potential problem. It's not a big issue, just one I like to cover, hence the code. Having done the code I felt compelled to share. I am happy with my solution. I had a need, and coded for it. I did not even consider trying to find other solutions ... not a big enough deal or common enough occurrence. TheDcoder and JockoDundee 2 Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
JockoDundee Posted June 13, 2021 Share Posted June 13, 2021 1 hour ago, TheSaint said: I am happy with my solution. I had a need, and coded for it. Fair enough. One question: what happens with shortened URI’s that are dynamically created via JS? For instance, let’s say there is a hard link to a static img “GOG/too........long.jpg”, which is also called via JS using string concatenation? Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
TheDcoder Posted June 13, 2021 Share Posted June 13, 2021 (edited) 2 hours ago, JockoDundee said: One question: what happens with shortened URI’s that are dynamically created via JS? I believe none of that stuff is saved in the webpage, the browser basically uses the raw HTML and then grabs all resources referenced in that HTML and saves them locally. So the scripts on that page will be saved as well, but may not work depending on the amount of context they require to function. Edit: Spoke too soon and thought too little, the dynamic stuff in the page is simply replaced with a local reference I believe, so all the "rendered" (dynamic) page is preserved visually without requiring the JS to run again to render it. Edited June 13, 2021 by TheDcoder EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
JockoDundee Posted June 14, 2021 Share Posted June 14, 2021 1 hour ago, TheDcoder said: I believe none of that stuff is saved in the webpage, the browser basically uses the raw HTML and then grabs all resources referenced in that HTML and saves them locally. So the scripts on that page will be saved as well, but may not work depending on the amount of context they require to function. Edit: Spoke too soon and thought too little, the dynamic stuff in the page is simply replaced with a local reference I believe, so all the "rendered" (dynamic) page is preserved visually without requiring the JS to run again to render it. Actually, I think you were correct when you spoke too soon and also correct when you spoke with the right amount of soon Since, certainly any html that is rendered on page load can be captured locally, but it can only go as far as what is known when the page’s initial load is finished. But let’s say a button has code that runs on onClick, which then has logic that constructs a URI to load another page. Not uncommon, I think. If the page name has been shortened, the concatenationed version of the file name will not match, I would imagine. Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now